ctf.network.tcp
Class Server

java.lang.Object
  extended by ctf.network.tcp.Server

public class Server
extends java.lang.Object

Used for communication between game and clients


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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Server

public Server(ServerOwner owner)
Default constructor

Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

stopAccepting

public void stopAccepting()
                   throws java.io.IOException
Shut down the server port

Throws:
java.io.IOException

bind

public void bind(int port)
          throws java.io.IOException,
                 java.net.UnknownHostException
Start listening for incoming connections

Parameters:
port - The TCP port to listen to
Throws:
java.io.IOException
java.net.UnknownHostException

startAccepting

public void startAccepting(int clients)
                    throws UninitializedSocketException
Starts accepting TCP clients (asynchronously)

Parameters:
clients - How many clients to accept (0 for no limit)
Throws:
UninitializedSocketException

accept

public Connection accept()
                  throws java.io.IOException,
                         SocketClosedException,
                         UninitializedSocketException
Accepts a connection from a client

Throws:
java.io.IOException
SocketClosedException
UninitializedSocketException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object