Gamemaster328
asked on
VB6: Winsock Trivia Game Problem
i made a trivia game for a friend. basically, the server sends questions to all the clients and who ever answers them first, gets a point. the problem is, sometimes winsock sends data a the same time. also, when the client disconnects, then tries to reconnect again, the server gets an error. i dont want to use "on error resume next" because that sometimes causes complications. is there any way to fix this winsock problem?
my code for sending data is
for a = 1 to wsk.ubound
if wsk(a).state = sckconnected then
wsk(a).senddata strData
end if
next a
now, it send the data correctly, but sometimes it sends them at the same time, and the String gets combined together.
-------------------------- ---------- ------
Sub 1:
strData = "Chat///Goodbye World"
for a = 1 to wsk.ubound
if wsk(a).state = sckconnected then
wsk(a).senddata strData
end if
next a
Sub 2:
strdata = "Com///Hello world"
for a = 1 to wsk.ubound
if wsk(a).state = sckconnected then
wsk(a).senddata strData
end if
next a
-------------------------- ---------- ------
when the client receives the data, it gets this:
"Chat///Goodbye WorldCom///Hello World".
could someone please help? if someone needs the source for both client and server, i would upload somewhere. thank you!
my code for sending data is
for a = 1 to wsk.ubound
if wsk(a).state = sckconnected then
wsk(a).senddata strData
end if
next a
now, it send the data correctly, but sometimes it sends them at the same time, and the String gets combined together.
--------------------------
Sub 1:
strData = "Chat///Goodbye World"
for a = 1 to wsk.ubound
if wsk(a).state = sckconnected then
wsk(a).senddata strData
end if
next a
Sub 2:
strdata = "Com///Hello world"
for a = 1 to wsk.ubound
if wsk(a).state = sckconnected then
wsk(a).senddata strData
end if
next a
--------------------------
when the client receives the data, it gets this:
"Chat///Goodbye WorldCom///Hello World".
could someone please help? if someone needs the source for both client and server, i would upload somewhere. thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER