That is a WinSock error, and it is returned automatically by the 
underlying socket API when a socket is not available to listen on a 
port.  Like Wilfried said, just stop listening on that port and any new 
connection attempts will receive the 10061 error.

        I mentioned TWSocketServer because it does this already in a more 
elegant way:  If the maximum number of connections are opened, it will 
accept the connection, and return a protocol error (e.g. "500 Server is 
busy.") in the welcome banner and immediately close the connection.


        DZ-Jay [TeamICS]

On Jan 22, 2008, at 14:19, Bart Thompson wrote:

> I am using a TWSocket in an application where it acts like a server
> socket (using listen and accept).
> I need to return a 10061 (connection refused error) if there are too
> many connections.
> Can anyone tell me how to accomplish this?
> Thanks.

To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to