Sign in to follow this  

Non-blocking accept sockets

This topic is 3903 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
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

This topic is 3903 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.

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