API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.net. ServerSocket View Source
Author(s)
unascribed
Since
JDK1.0
Version
1.91, 03/08/07
Serial
Hierarchy
 Object
      ServerSocket
Implements
Subclasses
Description
public class ServerSocket
  This class implements server sockets.
Constructors
public ServerSocket () throws IOException
  Creates an unbound server socket.
public ServerSocket (int port) throws IOException
  Creates a server socket, bound to the specified port.
public ServerSocket (int port, int backlog) throws IOException
  Creates a server socket and binds it to the specified local port number, with the specified backlog.
public ServerSocket (int port, int backlog, InetAddress bindAddr) throws IOException
  Create a server with the specified port, listen backlog, and local IP address to bind to.
Methods
Hide/Show inherited methods
public Socket accept () throws IOException
  Listens for a connection to be made to this socket and accepts it.
public void bind (SocketAddress endpoint) throws IOException
  Binds the ServerSocket to a specific address (IP address and port number).
public void bind (SocketAddress endpoint, int backlog) throws IOException
  Binds the ServerSocket to a specific address (IP address and port number).
public void close () throws IOException
  Closes this socket.
pack-private void createImpl () throws SocketException
  Creates the socket implementation.
public ServerSocketChannel getChannel ()
  Returns the unique ServerSocketChannel object associated with this socket, if any.
pack-private SocketImpl getImpl () throws SocketException
  Get the SocketImpl attached to this socket, creating it if necessary.
public InetAddress getInetAddress ()
  Returns the local address of this server socket.
public int getLocalPort ()
  Returns the port on which this socket is listening.
public SocketAddress getLocalSocketAddress ()
  Returns the address of the endpoint this socket is bound to, or null if it is not bound yet.
publicsynchronized int getReceiveBufferSize () throws SocketException
  Gets the value of the SO_RCVBUF option for this ServerSocket, that is the proposed buffer size that will be used for Sockets accepted from this ServerSocket.
public boolean getReuseAddress () throws SocketException
  Tests if SO_REUSEADDR is enabled.
publicsynchronized int getSoTimeout () throws IOException
  Retrieve setting for SO_TIMEOUT.
protectedfinal void implAccept (Socket s) throws IOException
  Subclasses of ServerSocket use this method to override accept() to return their own subclass of socket.
public boolean isBound ()
  Returns the binding state of the ServerSocket.
public boolean isClosed ()
  Returns the closed state of the ServerSocket.
pack-private void setBound ()
pack-private void setCreated ()
public void setPerformancePreferences (int connectionTime, int latency, int bandwidth)
  Sets performance preferences for this ServerSocket.
publicsynchronized void setReceiveBufferSize (int size) throws SocketException
  Sets a default proposed value for the SO_RCVBUF option for sockets accepted from this ServerSocket.
public void setReuseAddress (boolean on) throws SocketException
  Enable/disable the SO_REUSEADDR socket option.
publicstaticsynchronized void setSocketFactory (SocketImplFactory fac) throws IOException
  Sets the server socket implementation factory for the application.
publicsynchronized void setSoTimeout (int timeout) throws SocketException
  Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
public String toString ()
  Returns the implementation address and implementation port of this socket as a String.
Fields
Hide/Show inherited fields
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar