Socket
public Socket(String host,
int port,
InetAddress localAddr,
int localPort)
throws IOException
Creates a socket and connects it to the specified remote host on the specified remote port. The Socket will also bind() to the local address and port supplied.
If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException. Parameters:
host - the name of the remote host
port - the remote port
localAddr - the local address the socket is bound to
localPort - the local port the socket is bound to
Throws:
IOException - if an I/O error occurs when creating the socket.
SecurityException - if a security manager exists and its checkConnect method doesn't allow the operation.
Since:
JDK1.1
See Also:
SecurityManager.checkConnect(java.lang.String, int)
public Socket(String host,
int port,
InetAddress localAddr,
int localPort)
throws IOException
Creates a socket and connects it to the specified remote host on the specified remote port. The Socket will also bind() to the local address and port supplied.
If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException. Parameters:
host - the name of the remote host
port - the remote port
localAddr - the local address the socket is bound to
localPort - the local port the socket is bound to
Throws:
IOException - if an I/O error occurs when creating the socket.
SecurityException - if a security manager exists and its checkConnect method doesn't allow the operation.
Since:
JDK1.1
See Also:
SecurityManager.checkConnect(java.lang.String, int)
i think u can just use Socket(String host, int port), if u just use the socket as client socket.
java.net.BindException: Address already in use: JVM_Bind