@Deprecated
public Socket (String host, int port, boolean stream) throws IOException

Deprecated: Use DatagramSocket instead for UDP transport.

Creates a stream socket and connects it to the specified port number on the named host.

If the specified host is null it is the equivalent of specifying the address as InetAddress.getByName(null). In other words, it is equivalent to specifying an address of the loopback interface.

If the stream argument is true, this creates a stream socket. If the stream argument is false, it creates a datagram socket.

If the application has specified a server socket factory, that factory's createSocketImpl method is called to create the actual socket implementation. Otherwise a "plain" socket is created.

If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException.

If a UDP socket is used, TCP/IP related socket options will not apply.

Parameters:
host    the host name, or null for the loopback address.
port    the port number.
stream    a boolean indicating whether this is a stream socket or a datagram socket.

Exceptions:
IOException    if an I/O error occurs when creating the socket.
SecurityException    if a security manager exists and its checkConnect method doesn't allow the operation.
IllegalArgumentException    if the port parameter is outside the specified range of valid port values, which is between 0 and 65535, inclusive.

See also:
java.net.Socket.setSocketImplFactory(java.net.SocketImplFactory), java.net.SocketImpl, java.net.SocketImplFactory.createSocketImpl(), SecurityManager.checkConnect