std.socket Error: Too many open files.

Thomas Kuehne thomas-dloop at kuehne.cn
Sat Dec 9 03:40:38 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Morgan McDermott schrieb am 2006-12-09:
> Hi all,
>   I've found a limitation in my current setup as far as sockets go; once 
> I've  made about 500 transactions on different sockets between my test 
> client and test server, I receive the error "Error: Unable to create 
> socket. Too many open files." After I'm done with a socket I always shut 
> it down and close it.. I assume this is some sort of operating-system 
> specific limitation, but the explanation on std.socket.close ( 
> "Immediately drop any connections and release socket resources" ) seems 
> to state that any file handles would be closed upon calling 
> Socket.close(). Is there a large delay between the close()'ing and the 
> release of resources, or am I overlooking something else simple and obvious?

If you don't properly close the connection on both sides there are
delays. Do you encounter the same issues if you use the following code?

#
# // casting due to http://d.puremagic.com/issues/show_bug.cgi?id=667
# socket.shutdown(cast(SocketShutdown)2);
#
# socket.close();
#

instead of

#
# socket.close()
#

On Linux systems "netstat --tcp --numeric --programs --all" might help
you to identify "ghost" sockets.

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFeq20LK5blCcjpWoRAgSNAJ91TRz0/vRLYmaSEo1W3/pMifVhDACghTwB
flbtuQXL2aUKaSWelEgnni8=
=buHL
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-learn mailing list