954,193 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pass variables through network connection

Would anyone know how, if it's possible, to pass a user defined type through a network connection say using winsock?

For example:

type tExpl
      name as string
      address as string
      phone as string
end type
 
dim myExpl as tExpl
 
winsock1.send myExpl


As far as i know, winsock only sends text or raw data, anyone know if this is possible?

agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

No. The reason is because how VB handles UDT's in Late-Bound functions.... you could in theory cast it to an object, but trying to send an object through a socket never works right. Your best bet, is to convert the UDT to a single string variable, delimited by a character sequence of your choice, and then on the other side (the server, or whatever is "recieving" the UDT) rip apart the string by the delimiter and put it back into a UDT.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You