PDA

Click to See Complete Forum and Search --> : Winsock and multiuser


Fox
Jan 22nd, 2000, 09:24 PM
Hi,
I'm trying to do a chat application and I've got a problem with sending messages. That's what happens:

A user writes something and sends it to the server. Then the server (should) sends it to the other users, see code:

-
For A = 0 to WS.Count - 1
If WS(A).State = sckConnected then
WS(A).SendData iText
EndIf
Next
-

Well, what really happens is that only the last WS sends the text.
I also know that if you send every second one string that it works... But it should be FAST.

------------------
fox_mccloud@gmx.net
...
Every program can be reduced to one instruction which doesn't work.

dephcon
Jan 23rd, 2000, 06:57 AM
add this and see if it works mate:

For A = 0 to WS.Count - 1
If WS(A).State = sckConnected then
WS(A).SendData iText
DoEvents 'this makes it complete events
' first
EndIf
Next

if it dont work, then ya will have to supply mo' data kuz i am in the dark buddy.

<-- dephcon


------------------
"Fate is but an outline, we must fill in the rest."

Fox
Jan 23rd, 2000, 05:51 PM
Thanks, but the mistake was that I had to wait for the SendComplete event of the Winsock.

Thanks anyway!