|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectpacketNetworking.Communicator
packetNetworking.Server
public class Server
Server class. May connecto to several clients. Extends the communicator class
Field Summary | |
---|---|
protected boolean[] |
clientSocketsOpen
list of open clients. every bool is true only if corresponding client is open |
protected boolean[] |
hasSentPing
true if ping is sent corresponding client |
protected boolean |
isAllSocketsOpen
true only if all clients is connected |
protected int |
pingErrorCounter
counts the number of ping errors. |
protected int[] |
ports
lists of ports, sockets, sender objects and client sockets |
Constructor Summary | |
---|---|
Server(int[] ports)
Sets up a server waiting to connect on given ports |
Method Summary | |
---|---|
void |
Listen()
Start listening from clients |
void |
ProcessPacket(Packet pck)
Process ping packets only. |
void |
Talk(Packet pck)
Sends a message from the communicator Empty method to ensure it can be called, but all communicators may overwrite this method |
void |
Talk(Packet pck,
int index)
Sends a packet to a given client |
void |
UpdateStatus(int index)
Update connection status of the server |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int[] ports
protected boolean isAllSocketsOpen
protected int pingErrorCounter
protected boolean[] clientSocketsOpen
protected boolean[] hasSentPing
Constructor Detail |
---|
public Server(int[] ports)
ports
- Method Detail |
---|
public void ProcessPacket(Packet pck)
pck
- public void Talk(Packet pck)
Communicator
Talk
in class Communicator
public void Talk(Packet pck, int index)
command
- index
- public void Listen()
public void UpdateStatus(int index)
index
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |