Sign in to follow this  
thannett

SDL_net - Checking for incoming data

Recommended Posts

Is there a way to check if there is any incoming data on a socket? I read on another thread that SDLNet_TCP_Recv() will sit and wait if there is no incoming data. Does anyone know of a way to check if there is any incoming data before calling SDLNet_TCP_Recv()?

Share this post


Link to post
Share on other sites
Check out the parts on 'Socket Sets' in the SDL_net documentation. The functions provided can go through and check all of the sockets in a set for you and determine which have data ready to be processed, to avoid having a blocking delay when reading from a socket.

If you're Pascal-savvy, I found an example that shows some of its basic usage. I'm sure you'll be able to Google up some C/C++ ones if that's not of use, though. :)

Good luck!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this