Socket Members

Socket Members

Class Overview | This Package | All Packages

Constructors
Name Description
Socket() Creates an unconnected socket, with the system-default type of SocketImpl.
Socket(InetAddress, int) Creates a stream socket and connects it to the specified port number at the specified IP address.
Socket(InetAddress, int, boolean) Creates a socket and connects it to the specified port number at the specified IP address. Deprecated.
Socket(InetAddress, int, InetAddress, int) Creates a socket and connects it to the specified remote address on the specified remote port.
Socket(SocketImpl) Creates an unconnected Socket with a user-specified SocketImpl.
Socket(String, int) Creates a stream socket and connects it to the specified port number on the named host.
Socket(String, int, boolean) Creates a stream socket and connects it to the specified port number on the named host. Deprecated.
Socket(String, int, InetAddress, int) Creates a socket and connects it to the specified remote host on the specified remote port.

Methods
Name Description
close() Closes this socket.
getInetAddress() Returns the address to which the socket is connected.
getInputStream() Returns an input stream for this socket.
getLocalAddress() Gets the local address to which the socket is bound.
getLocalPort() Returns the local port to which this socket is bound.
getOutputStream() Returns an output stream for this socket.
getPort() Returns the remote port to which this socket is connected.
getSoLinger() Returns setting for SO_LINGER.
getSoTimeout() Returns setting for SO_TIMEOUT.
getTcpNoDelay() Tests if TCP_NODELAY is enabled.
setSocketImplFactory(SocketImplFactory) Sets the client socket implementation factory for the application.
setSoLinger(boolean, int) Enable/disable SO_LINGER with the specified linger time.
setSoTimeout(int) Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
setTcpNoDelay(boolean) Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).
toString() Converts this socket to a String.