public Socket createSocket(InetAddress address,int port,InetAddress myAddress,int myPort) throws IOException {
  if (myAddress != null) {
    Socket sock=new Socket();
    sock.bind(new InetSocketAddress(myAddress,0));
    try {
      sock.connect(new InetSocketAddress(address,port),8000);
    }
 catch (    SocketTimeoutException e) {
      throw new ConnectException("Socket timeout error (8sec)" + address + ":"+ port);
    }
    return sock;
  }
 else {
    Socket sock=new Socket();
    if (myPort != 0) {
      sock.bind(new InetSocketAddress(port));
    }
    try {
      sock.connect(new InetSocketAddress(address,port),8000);
    }
 catch (    SocketTimeoutException e) {
      throw new ConnectException("Socket timeout error (8sec)" + address + ":"+ port);
    }
    return sock;
  }
}

public Socket createSocket ( InetAddress address , int port , InetAddress myAddress , int myPort ) throws IOException { if ( myAddress != null ) { Socket sock = new Socket ( ) ; sock . bind ( new InetSocketAddress ( myAddress , 0 ) ) ; try { sock . connect ( new InetSocketAddress ( address , port ) , 8000 ) ; } catch ( SocketTimeoutException e ) { throw new ConnectException ( "Socket timeout error (8sec)" + address + ":" + port ) ; } return sock ; } else { Socket sock = new Socket ( ) ; if ( myPort != 0 ) { sock . bind ( new InetSocketAddress ( port ) ) ; } try { sock . connect ( new InetSocketAddress ( address , port ) , 8000 ) ; } catch ( SocketTimeoutException e ) { throw new ConnectException ( "Socket timeout error (8sec)" + address + ":" + port ) ; } return sock ; } }
creates a new socket , binds it to myaddress : myport and connects it to address : port .
