Page 1 of 1

Posted: Tue Jul 30, 2002 7:34 pm
by BackupUser
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

Posted: Tue Jul 30, 2002 7:44 pm
by BackupUser
Restored from previous forum. Originally posted by ricardo.

By Types i mean Structures : )

Posted: Tue Jul 30, 2002 8:05 pm
by BackupUser
Restored from previous forum. Originally posted by Rings.

Types are VB

Its a long way to the top if you wanna .....CodeGuru

Posted: Tue Jul 30, 2002 8:23 pm
by BackupUser
Restored from previous forum. Originally posted by ricardo.
Types are VB
Ok, i want to send structures... i need some help : )

Posted: Tue Jul 30, 2002 8:40 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

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))
  
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

Posted: Tue Jul 30, 2002 9:00 pm
by BackupUser
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:

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)
A ittle confusing, but it works...

Timo

Posted: Tue Jul 30, 2002 10:51 pm
by BackupUser
Restored from previous forum. Originally posted by ricardo.

Thanks Freak works excellent !!
Exactly was i was looking for