#include <netmanagerclient.h>
Inheritance diagram for NetManagerClient:
Public Methods | |
NetManagerClient (const string &server) | |
Creates a client NetManager object, "connected" to the indicated server. More... | |
~NetManagerClient () | |
Flushes the remaining data, closes the socket and destroys all the data structures. | |
void | send (MessagePacket &msg) |
Sends a message to the server. More... | |
void | send (const string &msg) |
Sends a single message to the server. More... | |
MessagePacket | next () |
Returns the next MessagePacket received from the socket. More... | |
void | flush () |
Flushes the output socket. More... | |
int | getClientID () const |
Returns our client index in the server. More... | |
Private Methods | |
virtual bool | forwardMessage (const MessagePacket &msg, IPaddress *ip) |
Determines whether the message should or not be forwarded to the user. More... | |
Private Attributes | |
MessagePacket | outputBuffer |
Contains the unsent message packets. More... | |
int | clientID |
Identifies the client in the server list. More... |
Client network manager class for Perihelion, with capabilities to send and receive MessagePacket objects, and return them to the class' users.
Please be aware of methods that can throw exceptions when indicated.
Note: Unless we find an use for them, channels in UCP sockets will be ignored, and 0 will be used by default.
|
Creates a client NetManager object, "connected" to the indicated server. Creates a client NetManager object, "connected" to the indicated server. The server address can be both in numeric or alphanumeric format, and there is no need to specify the port, since there is a fixed one. This could raise an exception if something goes wrong
|
|
Flushes the output socket. Flushes the output socket sending all the contained information. This method should be called once in a while, so that the size of the message to be send doesn't exceed the packet size. This method can raise exceptions if something goes wrong, so please catch the 'string'. |
|
Determines whether the message should or not be forwarded to the user.
Implements NetManager. |
|
Returns our client index in the server. Returns the client index of the client, as established by the server.
|
|
Returns the next MessagePacket received from the socket. Returns the next MessagePacket received from the socket. There is no need to indicate a socket number, since we are in the client and there is only one. This method can raise exceptions if something goes wrong, so please catch the 'string'.
|
|
Sends a single message to the server. Sends a single message to the server through the receiverSocket, which is also used to read messages from it. $$$ Actually, we still have to decide whether the message is sent or just scheduled for later delivery, until 'flush' is called. There is no need to indicate either a destination or source, since all the messages arrive to the server from this client, and can be identified as is. This method could raise exceptions when something fails, so please enclose its calls within a try-catch block.
|
|
Sends a message to the server. Sends a message to the server through the receiverSocket, which is also used to read messages from it. There is no need to set the client index number in the packet, since this is done inside the method. $$$ Actually, we still have to decide whether the message is sent or just scheduled for later delivery, until 'flush' is called. There is no need to indicate a destination, since all the messages arrive to the server. This method could raise exceptions when something fails, so please enclose its calls within a try-catch block.
|
|
Identifies the client in the server list. Identifies the client in the server list. Must be sent in each packet to make it easier for the server to keep track. |
|
Contains the unsent message packets. Contains the unsent message packets ready to be delivered. Messages are appended to each other, so that only one packet is sent afterwards, when flush is called. |