Sign in to follow this  

[.net] Asynchronous Sockets

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

Hey there! I'm having some problem with my asynchronous socket client. The problem is that when I connect with it to a specific server, I recieve the Connection Callback, and try to EndConnect(...) once it gets called. Then immediately I try to BeginRecieve(...). It seems that if I don't wait like 5 seconds with the BeginRecieve(...) call I get an exception thrown from it: "A request to send or receive data was disallowed because the socket is not connected" in BeginRecieve(...) Though If I let my client first connect with EndConnect(...), then wait 5 seconds and THEN i try BeginRecieve(...) everything works fine. Does anyone know why this might happen ? Thank you!

Share this post


Link to post
Share on other sites
The socket on the other end might be sending ack back and forth to allow the socket to shut down and close. Until that occurs, and exception will happen if you get in between that process. I've run into the problem before, and I can say that it is possible to fix it, but honestly, I don't recall how I fixed it last time. I can say that waiting was not what I did. I think I just dropped the connection in case of weird behavior.

Share this post


Link to post
Share on other sites
thx, but dropping the connection? This phenomenon is happening everytime i try to connect, not just every once in a while.

Also, when using javas non blocking io, everything works fine.

Now I switched to c# and async sockets. If I try connecting to another server that I have written myself, everything works fine.

Thx

Share this post


Link to post
Share on other sites

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