|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object game.net.Server_network_layer
public class Server_network_layer
This class is used by the server to get and send from the network. The server should be started first. Up to two client connections are accepted. These are referred to as west and east.
Field Summary | |
---|---|
static int |
EAST
Deprecated. Use a_soccertools.interfaces.Server_network_interface.EAST instead. |
static int |
WEST
Deprecated. Use a_soccertools.interfaces.Server_network_interface.WEST instead. |
Constructor Summary | |
---|---|
Server_network_layer()
Construct a network layer object. |
Method Summary | |
---|---|
int |
get_line(int mask,
java.lang.StringBuffer str_buf)
Attempt to read one line from a subset of the clients. |
void |
init(int server_port)
Initialize the network layer. |
void |
send_line(java.lang.String line,
int which)
Sends a line to one client. |
void |
shutdown()
Finish everything up |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int WEST
Server_network_interface
,
Constant Field Valuespublic static final int EAST
Server_network_interface
,
Constant Field ValuesConstructor Detail |
---|
public Server_network_layer()
Method Detail |
---|
public void init(int server_port) throws java.net.UnknownHostException, java.io.IOException
server_port
- this is the "well known port number" for the server.
java.net.UnknownHostException
- if the server host can not be found.
java.io.IOException
- if communication with the server can not be initialized.public void send_line(java.lang.String line, int which) throws java.io.IOException
send_line
in interface Server_network_interface
line
- this should end in a newline.which
- this should be server_network_layer.WEST or server_network_layer.EAST
java.io.IOException
- if the line can not be sent.Server_network_interface
public int get_line(int mask, java.lang.StringBuffer str_buf) throws java.io.IOException
get_line
in interface Server_network_interface
mask
- indicates where the line should come from.
It may be, WEST, EAST, or WEST|EAST to indicate either is ok.str_buf
- a string buffer onto which the line will be appended if
a line is read. Typically you would pass a new string buffer.
java.io.IOException
- if trouble reading the line.Server_network_interface
public void shutdown() throws java.io.IOException
java.io.IOException
- if any trouble ;
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |