[SDL] How to know when SDLNet_TCP_Recv has no more data available, or how to specify timeout for it?

necronology at cox.net necronology at cox.net
Sun Oct 7 19:28:05 PDT 2007


It's my understanding that most would use something like:
if (SDLNet_TCP_Recv(sd, (char*)buffer, 512)) so in your main loop you check to see if there is something to pick up and the answer is yes or no. You do have the choice not to check or to close out that sd. Is this what you mean by waiting?


---- "DARKGuy ." <dark.guy.2008 at gmail.com> wrote: 
> Yeah, is there a way to specify a timeout for SDLNet_TCP_Recv, or how to
> know when there's no more data, so SDLNet_TCP_Recv doesn't stay waiting for
> data to arrive? I'm thinking in using SDL threads, but I'm still not sure
> how do I apply them in my case...
> 
> I've also tried to search in google but I haven't found any info about
> applying a timeout either by SDL_Net or by threads...
> 
> Any help is greatly appreciated! :D
> 
> - DARKGuy



More information about the SDL mailing list