Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make sure WinSock sends to all clients?
    primarykey
    data
    text
    <p>I have written a vb6 game to allow 4 players to play a card game. One of the players will host the game and the others will join.</p> <p>I used a socket array to join all of the other players with the host socket</p> <p>Everything went smooth and I am able to send messages from each player to the rest of the players, from host to guests and vice versa</p> <p>However, during the game, one player would "tell" the host that a card is chosen. The host will then send the same message to each of the clients connected to the socket array like this</p> <pre><code>For i=1 to 3 Me.SocketArray(i).SendData player.selectedCard DoEvents Next </code></pre> <p>but for some reason, one of the player never receives the message. Although the same player did receive messages before this point, and possible will receive other messages later.</p> <p>So there is a Syncing problem with what was send and what was not. I looked for answers everywhere, and some suggested to use <code>DoEvents</code> more often to force the winsock to send the data immediately.</p> <p>I then thought of implementing an inbox for each player in which each player must reply with an acknowledgment of the received message, and the host will not send any more messages until the arrival of acknowledgement, but that made the game slower and I had the same problem I had before, but this time it's not the messages that got lost, it's the acknowledgment.</p> <p>The number 1 reason I think I am having all of this is that the Winsock control sometimes sends incomplete messages (one character missing) and that will create a mess, because I need every character at the other end, otherwise the message is useless.</p> <p>How can I make sure that whenever the host sends a message, all the other guests receive ALL of it intact?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload