
HELP! Winsock SendData and String
Hi Victor
The explaination and code below assumes you have all the declared variables,
winsock control named winsock1, a client side, a server side.
Here what you need to do:
At the Client Side:
lastname = "Merchant"
firstname = "Shajahan"
Age = "22'
str = lastname & ":" & firstname & ":" & Age ''Merchant:Shajahan:22
winsock1.remoteport = 1001
winsock1.remotehost = hostname
winsock1.connect
do while winsock1.state <> 7 ''wait till connected
Doevents
loop
winsock1.senddata str
winsock1.close
Thats it at client side.
At Server Side:
''in form_load:
Winsock1.LocalPort = 1001
Winsock1.Listen
''then accept connection in
''in connection_request
winsock1.accept repuest_id
''in winsock1_Dataarrival
dim indata as string
winsock1.GetData indata
''now you have the string sent by client in the variable indata
hope this helps
All the best
(Please verify the exact syntax ,mthods and events that are stated above.)