|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.ServerSocket
The server Socket class. It uses a SocketImpl to implement the actual socket operations. It is done this way so that you are able to change socket implementations depending on the kind of firewall being used. You can change socket implementations by setting the SocketImplFactory.
Constructor Summary | |
ServerSocket(int port)
Creates a server socket on a specified port. |
|
ServerSocket(int port,
int backlog)
Creates a server socket, binds it to the specified local port and listens to it. |
Method Summary | |
Socket |
accept()
Accepts a connection. |
void |
close()
Closes the server socket. |
InetAddress |
getInetAddress()
Gets the address to which the socket is connected. |
int |
getLocalPort()
Gets the port on which the socket is listening. |
static void |
setSocketFactory(SocketImplFactory fac)
Sets the system's server SocketImplFactory. |
String |
toString()
Returns the implementation address and implementation port of this ServerSocket as a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ServerSocket(int port) throws IOException
port
- the port
IOException
- IO error when opening the socket.public ServerSocket(int port, int backlog) throws IOException
port
- the specified portbacklog
- the number of queued connect requests pending acceptMethod Detail |
public InetAddress getInetAddress()
public int getLocalPort()
public Socket accept() throws IOException
IOException
- IO error when waiting for the connection.public void close() throws IOException
IOException
- IO error when closing the socket.public String toString()
toString
in class Object
public static void setSocketFactory(SocketImplFactory fac) throws IOException
fac
- the desired factory
SocketException
- If the factory has already been
defined.
IOException
- IO error when setting the socket factor.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |