Creates a stream socket and connects it to the specified port
number on the named host.
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.
Exceptions
IOException
if an I/O error occurs when creating the socket.
Creates a stream socket and connects it to the specified port
number at the specified IP address.
If the application has specified a socket factory, that factory's
createSocketImpl method is called to create the
actual socket implementation. Otherwise a "plain" socket is created.
Exceptions
IOException
if an I/O error occurs when creating the socket.
Creates a socket and connects it to the specified remote host on
the specified remote port. The Socket will also bind() to the local
address and port supplied.
Creates a socket and connects it to the specified remote address on
the specified remote port. The Socket will also bind() to the local
address and port supplied.
public Socket( String host,
int port,
boolean stream ) throws IOException
Parameters
host
the host name.
port
the port number.
stream
a boolean indicating whether this is
a stream socket or a datagram socket.
Description
Note: Socket() is 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 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.
Exceptions
IOException
if an I/O error occurs when creating the socket.
if true, create a stream socket;
otherwise, create a datagram socket.
Description
Note: Socket() is deprecated.Use DatagramSocket instead for UDP transport.
Creates a socket and connects it to the specified port number at
the specified IP address.
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.
Exceptions
IOException
if an I/O error occurs when creating the socket.