#include <server.hh>
Inheritance diagram for PIAVE::Server:
Public Methods | |
int | execute () |
Starts the execution of the cutter. | |
void | sendMessage (const std::string &str) |
Sends a message down the communication socket. | |
Protected Methods | |
virtual void | startProcessCommandsLoop ()=0 |
Process any commands that have been recieved, send any acknowledgements that are required. | |
Private Methods | |
void | initListenSocket () |
Initialise a server and start listening for connections. | |
void | closeListenSocket () |
Close down the socket that listens for connections. | |
void | closeCommSocket () |
Close down the socket that communicates with the client. | |
Private Attributes | |
State | _state |
This server is a little state mashine. | |
unsigned short | m_port |
The port that the cutter listens in on. | |
int | m_listenSocket |
The socket used for listening. | |
int | m_commSocket |
The socket used for communication. | |
sockaddr_in | m_socketAddress |
The internet address that this socket is bound to. | |
std::string | m_commandBuffer |
The command buffer, stores partial commands until the rest of them is picked up. | |
int | m_totalBytesRead |
The total bytes read in the recieveMessage method. | |
std::string | m_messageBuffer |
A string buffer which stores recieved messages until they are complete. |
This base class handles the necessary tcpsetup required for the renderer to connect to a client
This class is implemented as a "state mashine".
state_not_initialized <-\ -> state_not_connected, <---\ | -> state_connected, <----\ --/ | -> state_process_commands, --/ | -> state_shutting_down ---/ -> state_error_connecting,
|
Starts the execution of the cutter. This is the main loop; by the time this function is called, the server is already listening for connections. |
|
Sends a message down the communication socket. Convenience function. |
|
The total bytes read in the recieveMessage method. This resets to 0 whenever a full message has been recieved. |