Main Page   Class Hierarchy   Compound List   Compound Members  

ArNetServer Class Reference

Class for running a simple net server to send/recv commands via text. More...

#include <ArNetServer.h>

List of all members.

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.


Detailed Description

Class for running a simple net server to send/recv commands via text.

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.


Member Function Documentation

bool ArNetServer::addCommand const char *    command,
ArFunctor3< char **, int, ArSocket *> *    functor,
const char *    help
 

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)

bool ArNetServer::open ArRobot   robot,
unsigned int    port,
const char *    password,
bool    multipleClients
 

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)

Parameters:
robot  the robot that this should be attached to and run in the sync task of or NULL not to run in any robot's task
port  the port to start up the service on
password  the password needed to use the service
multipleClients  if false only one client is allowed to connect, if false multiple clients are allowed to connect or just one
Returns:
true if the server could be started, false otherwise

bool ArNetServer::remCommand const char *    command
 

Removes a command.

Parameters:
command  the command to remove
Returns:
true if the command was there to remove, false otherwise

void ArNetServer::sendToAllClients const char *    str,
...   
 

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


The documentation for this class was generated from the following files:
Generated on Tue Nov 12 17:43:59 2002 for Aria by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001