public class Server extends Object implements AutoCloseable
Socket-based Server that can
handle, using OperationHandlers, Operations invoked by
Clients.Client,
Operation,
OperationHandler| Constructor and Description |
|---|
Server(int port)
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOperationHandler(OperationHandler handler)
Registers the specified
OperationHandler for an operation. |
void |
close()
Stops the
Server. |
InetAddress |
getInetAddress()
Obtains the
InetAddress on which the Server is listening. |
int |
getPort()
Obtains the port on which the
Server is listening. |
InetAddress |
open()
Opens and starts the
Server. |
public Server(int port)
port - the port on which to accept Client connections and requestspublic void addOperationHandler(OperationHandler handler)
OperationHandler for an operation.handler - the OperationHandlerpublic InetAddress open() throws IOException
InetAddress on which the Server
is accepting requests from Clients.IOExceptionpublic InetAddress getInetAddress()
InetAddress on which the Server is listening.InetAddresspublic int getPort()
Server is listening.public void close()
close in interface AutoCloseableCopyright © 2014. All Rights Reserved.