Jump to content
  • Advertisement
Sign in to follow this  
Crazyfool

Non-blocking accept sockets

This topic is 4184 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am working on some network code and I got non-blocking sockets to do non-blocking recv calls via the ioctlsocket method, but when I try to do that on the server socket, the accept() method still blocks.
u_long iMode = 1;
ioctlsocket(server, FIONBIO, &iMode);
I also do that to all the sockets representing clients. Thanks in advanced.

Share this post


Link to post
Share on other sites
Advertisement
Are you sure the call to ioctlsocket is succeeding, i.e. no error result? When are you setting FIONBIO in relation to your socket and listen and accept calls?

Share this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
Are you sure the call to ioctlsocket is succeeding, i.e. no error result? When are you setting FIONBIO in relation to your socket and listen and accept calls?


Well, not entirely - I am doing it the same way I'm doing it to all othersockets, and they succeed, but I guess its possible that in the same function, some sockets succeed and some dont?

I'm going crazy!

Edit, should I make a while loop something like:


while(!ioctlsocket(...));


I think they ARE failing.. its supposed to return 0, but when I do a while != 0, it goes on forever.. for all sockets.

This is weird because the recv() calls are non-blocking..


I think I got it to work, thanks Apoch, you were right. I dont understanbd how they failed but still made recv() calls non-blocking

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!