Thread: Socket Sends too fast

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    38

    Question Socket Sends too fast

    I'm finding if i send many messages in a row I need to use a sleep because som of my messages are being recv conncatinated.

    Is there a way I can send and recv messages between client and server (using sockets) without having to use sleep.

    Thanks

  2. #2
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    I really have no clue what I'm talking about, but from the little that I know, it sounds to me like you just need to flush the buffer. Let's say you send like 3 messages all in a row, and they all get stringed together, isn't that because they all got shoved in the buffer before the buffer was flushed? So every time you hit "send" or whatever it is that you do, make sure the buffer is flushed. And hey, feel free to flame me if I'm totally off.
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  3. #3
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by avalanche333 View Post
    I'm finding if i send many messages in a row I need to use a sleep because som of my messages are being recv conncatinated.
    That is just normal behavour. There is no guarantee how messages arrive at the server ( or client ). They could come all together or could even be split into more messages then you send. If you want to send and handle explicit messages then you have to implement some kind of handshake between server and client.
    Kurt

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    38
    ah thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  2. Datagram Unix socket problem
    By karas in forum C Programming
    Replies: 9
    Last Post: 07-27-2006, 10:08 AM
  3. problem closing socket
    By Wisefool in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-29-2003, 12:19 PM
  4. problem closing a socket
    By Wisefool in forum C Programming
    Replies: 1
    Last Post: 10-28-2003, 01:38 PM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM