C++ exception in WSA listen() call
I'm getting the same error as this user. My code is very similar.
Socket Exception: "There are no more endpoints 开发者_StackOverflow中文版available from the endpoint mapper"
I tried all that he did and my listen() call still generates an exception but no error code is reported. WSAGetLastError() also does not give me any errors. It seems to pass. However, when I look at the open ports using 'netstat -an', my port is not listed. I tried bumping (SOMAXCONN) and lowering (10 and 1) the backlog parameter on listen(). Does anyone have any insight on this problem?
My UDP code works fine. The TCP code does not. I'm running Windows Server 2003 R2.
NOTE: This code is part of a unit test where I listen on a port and connect to 127.0.0.1 to that port.
The answer in the cited thread stating that you should ignore the first-chance exception is correct. This is not a sockets problem and it certainly doesn't require fiddling with registry entries, or SO_LINGER. Your backlog will be adjusted upwards to 50 so you may as well set it to that.
精彩评论