new Socket(InetAddress address, int port) throws IOException


import java.net.InetAddress;
import java.net.Socket;

public class Main {
  public static void main(String[] argv) throws Exception {
    InetAddress addr = InetAddress.getByName("java.sun.com");
    int port = 80;

    Socket socket = new Socket(addr, port);
  }
}
Home 
  Java Book 
    Networking  

Socket:
  1. Socket
  2. new Socket(InetAddress address, int port) throws IOException
  3. Socket: connect(SocketAddress endpoint, int timeout) throws IOException
  4. Socket: getInputStream() throws IOException
  5. Socket: getLocalSocketAddress()
  6. Socket: getOutputStream() throws IOException
  7. Socket: getRemoteSocketAddress()
  8. Socket: readUTF() and writeUTF(String str)