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

This is a discussion on How can I tell when receiving buffer is no longer receiving? within the C Programming forums, part of the General Programming Boards category; Basically I'm connecting to a server. I have the client reading in what the server says. How can I tell ...

  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
    Katy, Texas
    Posts
    2,309
    I would think you could derive some type of protocol. For instance, if the server sends "done", then you know it is done.

    Todd
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 04: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, 10:12 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 04:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21