import java.net.Socket;
public class MainClass {
public static void main(String[] args) throws Exception {
Socket theSocket = new Socket("127.0.0.1", 80);
System.out.println("Connected to " + theSocket.getInetAddress() + " on port "
+ theSocket.getPort() + " from port " + theSocket.getLocalPort() + " of "
+ theSocket.getLocalAddress());
}
}
|