Thread: How can I tell when receiving buffer is no longer receiving?

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    26

    How can I tell when receiving buffer is no longer receiving?

    Basically I'm connecting to a server.
    I have the client reading in what the server says.
    How can I tell when the server is done sending data?

    Here is what I have
    Code:
    while(recv(sockfd,buf,MAXDATASIZE-1,0))
         {
             printf("%s",buf);
         }
    
    // but now, after it's done receiving i want to send something.
    //i just dont want to send while im still receiving.
    Thanks

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I would think you could derive some type of protocol. For instance, if the server sends "done", then you know it is done.

    Todd
    Mainframe assembler programmer by trade. C coder when I can.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  3. buffer contents swapping
    By daluu in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2004, 02:34 PM
  4. Tetris Questions
    By KneeGrow in forum Game Programming
    Replies: 19
    Last Post: 10-28-2003, 11:12 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 05:15 AM