Jump to content
  • Advertisement
Sign in to follow this  
bilsa

[.net] Asynchronous Sockets

This topic is 4257 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
Advertisement
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
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!