Hi all,<br><br>I found a problem when using port different from the default 445. If the specified port is wrong, and the actual server accepts connections on the default 445 port, due to this code:<br><br>try {<br>      negotiate( port, resp );<br>
} catch( ConnectException ce )  {<br>      port = (port == 0 || port == DEFAULT_PORT) ? 139 : DEFAULT_PORT;<br>      negotiate( port, resp );<br>} <br><br>the connection is successful and the fact the port is wrong is hidden from the user. But since the port is changed to the default, and the user is not aware, when later other operation is performed on smb file configured with the wrong port, the already opened session cannot be reused, since the &#39;matches&#39; method on the SmbTransport class fails because of this: (port == 0 || port == this.port). Port here is the wrong one, while this.port is actually the default. As a result, a new SmbTransport is created. Thus, on each file operation, a new transport is created and after a short time on extensive operations, we get run out of free connections.<br>
<br>I think this silent port change is not correct - I prefer thwrowing the exception here, so that we know there is a problem. I suggest this to be fixed. Also, a configuration property can be added to modify this behaviour - to throw exception or not. <br>
<br>Regards,<br>Gergan.<br>