Sockets
A java.net.Socket provides an easy interface to a TCP connection.
Of the eight Socket constructors, there are generally four commonly used:
public Socket(InetAddress address, int port);
Creates a stream socket and connects it to the specified port number at the specified IP address.
public Socket(InetAddress address, int port, InetAddress localAddr, int localPort);
Creates a socket and connects it to the specified remote address on the specified remote port.
public Socket(String host, int port);
Creates a stream socket and connects it to the specified port number on the named host.
public Socket(String host, int port, InetAddress localAddr, int localPort);
Creates a socket and connects it to the specified remote host on the specified remote port.