#include <ArNetServer.h>
Public Methods | |
ArNetServer (void) | |
Constructor. | |
~ArNetServer (void) | |
Destructor. | |
bool | open (ArRobot *robot, unsigned int port, const char *password, bool multipleClients) |
Initializes the server. More... | |
void | close (void) |
Closes the server. | |
bool | addCommand (const char *command, ArFunctor3< char **, int, ArSocket *> *functor, const char *help) |
Adds a new command. More... | |
bool | remCommand (const char *command) |
Removes a command. More... | |
void | sendToAllClients (const char *str,...) |
Sends the given string to all the clients. More... | |
bool | isOpen (void) |
Sees if the server is running and open. | |
void | runOnce (void) |
the internal sync task we use for our loop. | |
void | internalGreeting (ArSocket *socket) |
the internal function that gives the greeting message. | |
void | internalHelp (ArSocket *socket) |
The internal function that does the help. | |
void | internalHelp (char **argv, int argc, ArSocket *socket) |
The internal function for the help cb. | |
void | internalQuit (char **argv, int argc, ArSocket *socket) |
The internal function for closing this connection. | |
void | internalShutdown (char **argv, int argc, ArSocket *socket) |
The internal function for shutting down. |
This class is for running a simple net server which will have a list of commands to use and a fairly simple set of interactions... Start the server with the open function, add commands with the addCommand function and remove commands with remCommand, and close the server with the close function.
|
Adds a new command. This adds a command to the list, when the command is given the broken up argv and argc are given along with the socket it came from (so that acks can occur) |
|
Initializes the server. Open the server, if you supply a robot this will run in the robots attached, if you do not supply a robot then it will be open and you'll have to call runOnce yourself (this is only recommended for advanced users)
|
|
Removes a command.
|
|
Sends the given string to all the clients. This sends the given string to all the clients, this string cannot be more than 2048 number of bytes |