Skip to main content
GameDev.net gamedev.net
🔒 Locked

using the select function

Started by obj63 Mar 31, 2004 at 3:54 PM 1 replies 300+ views
Original Post
obj63
obj63
I am using the select function and I am selecting between a fd_set that contains my socket and a time interval. FD_SET(udpsock, &mySet); select(1, &mySet , NULL, NULL, &time); and when the time is up I want to run some set of code, and when the udpSock is writen to I want to run some other set of code. I know for the udp sock it is if(FD_ISSET(udpSock, &mySet)) { //code for udpSock } but I do not know what to do for when the time is up. Thanks for all help Joe Madden
SiCrane
SiCrane
If the select statment timed out, then the fd_set shouldn''t have udpsock set. This sounds like the perfect time to use the "else" keyword.
obj63
obj63
thanks I''ll try that, but if the time is set at 15 seconds
and I use else,

so if(FD_ISSET(...))
{
}
else
{
//rest code
}

will the else statement run at that 15 sec interval
Thats what I am confused about

Thanks again
Joe

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.