Socket.java (getPort): Return 0 instead of -1 on unconnected sockets.

2004-11-06  Noa Resare  <noa@resare.com>

       * java/net/Socket.java (getPort): Return 0 instead of -1 on
       unconnected sockets.

From-SVN: r90178
This commit is contained in:
Noa Resare 2004-11-06 16:49:56 +00:00 committed by Mark Wielaard
parent c2e999dfeb
commit 8d43449bee
2 changed files with 7 additions and 2 deletions

View file

@ -520,14 +520,14 @@ public class Socket
/**
* Returns the port number of the remote end of the socket connection. If
* this socket is not connected, then -1 is returned.
* this socket is not connected, then 0 is returned.
*
* @return The remote port this socket is connected to
*/
public int getPort()
{
if (! isConnected())
return -1;
return 0;
try
{