Restored from previous forum. Originally posted by ricardo.
Hi,
I want to send info to a server and the best way is sending Types, but i dont know how to send it and how to code the server to read it. Does anybody can help me?
Thanks in advance
Send types to a server?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
It's very easy:
That's it, no big deal.
Timo
--
A debugged program is one for which you have not yet found the conditions that make it fail.
Edited by - freak on 30 July 2002 21:41:37
It's very easy:
Code: Select all
; Client's side:
Structure Test
long.l
word.w
EndStructure
var.Test\long = 1
var.Test\word = 2
SendNetworkData(Id.l, @var, SizeOf(Test))
; Server Side:
Structure Test
long.l
word.w
EndStructure
var2.Test
ReceiveNetworkData(Id.l, @var2, SizeOf(Test))
Timo
--
A debugged program is one for which you have not yet found the conditions that make it fail.
Edited by - freak on 30 July 2002 21:41:37
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Hi again,
I've just noticed, that it's not that easy, if the structure contains a string.
Becourse Strings have a variable size, so the server can't know how big the
Structure really is.
But you can do it like that:
A ittle confusing, but it works...
Timo
Hi again,
I've just noticed, that it's not that easy, if the structure contains a string.
Becourse Strings have a variable size, so the server can't know how big the
Structure really is.
But you can do it like that:
Code: Select all
Structure Test
string.b[100] ; 100 bytes for the String
EndStructure
var.Test
PokeS(@var\string[0], "Hello World") ; fill the String
string.s = PeekS(@var\string[0]) ; get String (at Servers Side)
Timo
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm