Results 1 to 3 of 3

Thread: Winsock and multiuser

  1. #1

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Post

    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.

    ------------------
    [email protected]
    ...
    Every program can be reduced to one instruction which doesn't work.


  2. #2
    New Member
    Join Date
    Jan 2000
    Posts
    9

    Post

    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."

  3. #3

    Thread Starter
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Post

    Thanks, but the mistake was that I had to wait for the SendComplete event of the Winsock.

    Thanks anyway!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width