can any one point out the reason why u cant send and receive on a socket at the same time ?
to my understanding there are 2 streams one to push and one to pull
if you attempt to send/receive simultaneously you will get wasealready error
what is the reason that the socket throws wasealready error (10035)
does it have any thing to do with the ack window the receiving side sends back ?
as if to keep the line open for the window ?
First, I think you’re confused with your error codes. Here’s a few codes that might be relevant:
connect()with a socket that’s already in the middle of connecting.The main factor preventing you from doing two blocking operations at once is the
WSAEINPROGRESSerror – a limitation in the Winsock 1.1 API only allows you to do one blocking operation at once. You can get around this by using non-blocking overlapped calls and the Winsock 2.0 API to simulate blocking calls. For example:This approach is a bit more complex, but very flexible – once you fire off an overlapped I/O job, the very same thread can go on to do other work (as long as you keep the buffers and what not allocated!). The one thing to watch out for is that if you do this on your GUI thread, you’ll need to change the message loop – in order for overlapped events to complete, the thread that issued them needs to perform an alertable wait using eg
MsgWaitForMultipleEvents. In the above example I’m usingWSAWaitForMultipleEventsto perform this alertable wait. Also, the thread that issues an overlapped I/O request must not terminate until the request completes.For more general information on overlapped I/O, see this MSDN page: http://msdn.microsoft.com/en-us/library/ms686358(v=vs.85).aspx