构造Socket
Socket构造方法如下:
1 Socket() 2 //Creates an unconnected socket, with the system-default type of SocketImpl. 3 4 Socket(InetAddress address, int port) 5 //Creates a stream socket and connects it to the specified port number at the 6 //specified IP address. 7 8 Socket(InetAddress host, int port, boolean stream) 9 //Deprecated. 10 //Use DatagramSocket instead for UDP transport. 11 12 Socket(InetAddress address, int port, InetAddress localAddr, int localPort) 13 //Creates a socket and connects it to the specified remote address on the 14 //specified remote port. 15 16 Socket(Proxy proxy) 17 //Creates an unconnected socket, specifying the type of proxy, if any, that 18 //should be used regardless of any other settings. 19 20 Socket(SocketImpl impl) 21 //Creates an unconnected Socket with a user-specified SocketImpl. 22 23 Socket(String host, int port) 24 //Creates a stream socket and connects it to the specified port number on the 25 named host. 26 27 Socket(String host, int port, boolean stream) 28 //Deprecated. 29 //Use DatagramSocket instead for UDP transport. 30