Alex, This is just a guess on my part, so take it for what it is worth. The JVM randomly assigns a local port for an outbound connection, if the port has not been explicitly given. I assume most JVMs make no provisions to ensure that under no circumstances the same number gets assigned more than once. When under heavy load it is perfectly feasible that, while a connection is being established, the same number gets assigned to another connection, thus causing BindException.
Consider the following options: (1) reuse connections as much as possible to minimize odds of having to open new sockets (2) implement your own algorithm to assign local ports (3) simply retry Socket#bind method in case of BindException Hope this helps Oleg On Thu, May 19, 2005 at 09:41:04AM +0100, [EMAIL PROTECTED] wrote: > 1.4.2_04 on windows XP > > > > > > Ortwin Gl?ck <[EMAIL PROTECTED]> > 18/05/2005 15:05 > Please respond to "HttpClient Project" > > > To: HttpClient Project <[email protected]> > cc: > Subject: Re: Attempt to implement HA with HttpClient > > > Which JDK are you using? I suspect 1.4.0 or 1.4.1. > > Ortwin Gl?ck > > [EMAIL PROTECTED] wrote: > > Address already in use: connect > > java.net.BindException: Address already in use: connect > > at java.net.PlainSocketImpl.socketConnect(Native Method) > > at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) > > at > > java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) > > at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) > > at java.net.Socket.connect(Socket.java:452) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > This communication is for informational purposes only. It is not intended > as an offer or solicitation for the purchase or sale of any financial > instrument or as an official confirmation of any transaction. All market > prices, > data and other information are not warranted as to completeness or accuracy > and > are subject to change without notice. Any comments or statements made herein > do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries > and affiliates > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
