I suspect that SSLSocketFactory lets the underlying TCP/IP implementation assign the 
local port.  The behavior you describe is common.  I've seen it with telnet, Web 
browsers and SQL Server client software.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Trimarchi Michele" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 17, 2003 6:57 AM
Subject: localPort number policy


Hi to all.
I have a question about how SSLSocketFactory uses localPort number.
Which is the policy that SSLSocketFactory uses to get localport number?


I put a print on SSLUtil.java after createSocket(..):

sslSocket = (SSLSocket) factory.createSocket(host, port);
System.out.println(sslSocket);


Everytime i do a  "call.invoke(...)" i see  that localport number is increased.

[SSL_NULL_WITH_NULL_NULL: 
Socket[addr=sodcsap1.dcdev.gcv/192.168.22.41,port=443,localport=1166]]
[SSL_NULL_WITH_NULL_NULL: 
Socket[addr=sodcsap1.dcdev.gcv/192.168.22.41,port=443,localport=1167]]
[SSL_NULL_WITH_NULL_NULL: 
Socket[addr=sodcsap1.dcdev.gcv/192.168.22.41,port=443,localport=1168]]
...
[SSL_NULL_WITH_NULL_NULL: 
Socket[addr=sodcsap1.dcdev.gcv/192.168.22.41,port=443,localport=1253]]


I saw also that socket is closed correctly and also netstat confirm it (HTTPUtils 
closes the socket on post() method) .

Why doesn't SSLSocketFactory reuse localport number released by socket.close() and 
instead continues to increase localport number?

Maybe is a newbie question ..sorry for that :-) ..

Michele




Reply via email to