Click to See Complete Forum and Search --> : connect() succeeds but accept() does not?


neonext
October 12th, 2009, 03:58 PM
Please help me with this problem. I'm working on a time-sensitive project where I'm using TCP sockets. I've got this problem where most of the time a connection cannot be made.

While debugging, I see that the connect() call on the client succeeds but on the host machine it will just be stuck on accept (or just bypass it with EWOULDBLOCK if it was set to a non-blocking socket)

I'm not very experienced with socket programming, so I'm not sure what can cause this behavior. Also what makes it difficult to solve is that sometimes it works perfectly fine.

What are some possible reasons for this problem to occur?

hoxsiew
October 12th, 2009, 04:11 PM
Please post some code. It's difficult to tell what might be happening from your description alone.

neonext
October 12th, 2009, 04:29 PM
nevermind, the problem seems to have gone away by threading the accept call

FilipDimitrov1967
November 11th, 2009, 05:53 AM
I met this behavior in 2 cases :
1. In some server implementations (too long to explain all, but in general when server is async) client connect succeeds, but to unblock server's accept you need to send some data to server too.
2. Some bug in XP, check my other post : http://www.codeguru.com/forum/showthread.php?t=486212