I'm getting the same error as this user. My code is very similar.
Socket Exception: "There are no more endpoints 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.