commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chitraa <achitral...@gmail.com>
Subject The java.net.SocketException: No buffer space available (maximum connections reached?): listen failed Exception
Date Tue, 02 Sep 2008 13:01:44 GMT

Hi all,

Although the subject of this message indicates that the Exception I am
getting is a java thing, I am using the apache.commons.net package and have
a suspicion that it could be related to this library.

Here's a bit about my program. My program makes a TCPIP connection to other
machines and uses the FTP protocol to retrieve files to download on the
remote machine. I am using the apache.commons.net.FtpClient java class to
provide me with an interface that allows me to connect to the remote
machine, log on, list the files that are on the remote computer and download
all the files that I need.

I have written my own implementation for apache.commons.net.SocketFactory.
Also, I have ensured that when I connect to a machine and open a socket, I
disconnect when I am done with the connection.

After 2 days, I get this exception:

java.net.SocketException: No buffer space available (maximum connections
reached?): listen failed
at java.net.PlainSocketImpl.socketListen(Native Method)
at java.net.PlainSocketImpl.listen(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at
com.mypackage.TimeoutSettingServerSocketProxy.<init>TimeoutSettingServerSocketProxy.java:28)
at
com.mypackage.MySocketFactory.createServerSocket(RedflexSocketFactory.java:69)
at
org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:475)
at org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1285)

After running a few test programs, I realised that this was because the
server was having too many open connections. I have checked my program and I
have closed all open sockets. So, I was wondering if there is an issue with
apache.commons.net? Does FTPClient open up a ServerSocket without closing
it?

Also, whats interesting is that once this exception has been thrown, I get
disconnected from the machine. Reconnecting to it will obviously throw the
exception again. However, when I connect to other machines, it throws the
same exception:

Failed to connect to 192.168.1.2 No buffer space available (maximum
connections reached?): connect

If the 'no buffer space available' is thrown because of too many open
connections on the server, why can't I connect to other servers (which don't
have many open connections). Why does the client (my machine) throw that
same exception when trying to connect to OTHER machines?

Thank you.
Kind regards,
Chitra
-- 
View this message in context: http://www.nabble.com/The-java.net.SocketException%3A-No-buffer-space-available-%28maximum-connections-reached-%29%3A-listen-failed-Exception-tp19269806p19269806.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message