|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectctf.network.tcp.Server
public class Server
Used for communication between game and clients
Nested Class Summary | |
---|---|
(package private) class |
Server.ConnectionAcceptor
A thread to accept connections |
Field Summary | |
---|---|
(package private) java.net.ServerSocket |
acceptorSocket
The socket we're listening to |
(package private) Server.ConnectionAcceptor |
connectionAcceptor
A thread to accept connections |
(package private) int |
maxClients
The maximum number of clients that we will accept (-1 for unlimited) |
(package private) ServerOwner |
owner
Who owns this Server |
Constructor Summary | |
---|---|
Server(ServerOwner owner)
Default constructor |
Method Summary | |
---|---|
Connection |
accept()
Accepts a connection from a client |
void |
bind(int port)
Start listening for incoming connections |
void |
finalize()
|
void |
startAccepting(int clients)
Starts accepting TCP clients (asynchronously) |
void |
stopAccepting()
Shut down the server port |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
java.net.ServerSocket acceptorSocket
ServerOwner owner
int maxClients
Server.ConnectionAcceptor connectionAcceptor
Constructor Detail |
---|
public Server(ServerOwner owner)
Method Detail |
---|
public void finalize()
finalize
in class java.lang.Object
public void stopAccepting() throws java.io.IOException
java.io.IOException
public void bind(int port) throws java.io.IOException, java.net.UnknownHostException
port
- The TCP port to listen to
java.io.IOException
java.net.UnknownHostException
public void startAccepting(int clients) throws UninitializedSocketException
clients
- How many clients to accept (0 for no limit)
UninitializedSocketException
public Connection accept() throws java.io.IOException, SocketClosedException, UninitializedSocketException
java.io.IOException
SocketClosedException
UninitializedSocketException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |