Logo Search packages:      
Sourcecode: poco version File versions  Download package

EchoServer Class Reference

#include <EchoServer.h>

Inheritance diagram for EchoServer:

Poco::Runnable Poco::Util::ServerApplication Poco::Util::Application Poco::Util::Subsystem Poco::RefCountedObject

List of all members.


Detailed Description

A simple sequential echo server.

The main application class.

This class handles command-line arguments and configuration files. Start the EchoServer executable with the help option (/help on Windows, --help on Unix) for the available command line options.

To use the sample configuration file (EchoServer.properties), copy the file to the directory where the EchoServer executable resides. If you start the debug version of the EchoServer (EchoServerd[.exe]), you must also create a copy of the configuration file named EchoServerd.properties. In the configuration file, you can specify the port on which the server is listening (default 9977) and the format of the date/time string sent back to the client.

To test the EchoServer you can use any telnet client (telnet localhost 9977).

Definition at line 122 of file EchoServer.cpp.


Public Types

enum  ConfigPriority { PRIO_APPLICATION = -100, PRIO_DEFAULT = 0, PRIO_SYSTEM = 100 }
enum  ExitCode {
  EXIT_OK = 0, EXIT_USAGE = 64, EXIT_DATAERR = 65, EXIT_NOINPUT = 66,
  EXIT_NOUSER = 67, EXIT_NOHOST = 68, EXIT_UNAVAILABLE = 69, EXIT_SOFTWARE = 70,
  EXIT_OSERR = 71, EXIT_OSFILE = 72, EXIT_CANTCREAT = 73, EXIT_IOERR = 74,
  EXIT_TEMPFAIL = 75, EXIT_PROTOCOL = 76, EXIT_NOPERM = 77, EXIT_CONFIG = 78
}

Public Member Functions

void addSubsystem (Subsystem *pSubsystem)
 Creates the Application and calls init(argc, argv).
std::string commandName () const
LayeredConfiguration & config () const
 Returns the command name used to invoke the application.
void duplicate () const
template<class C>
C & getSubsystem () const
void init (const std::vector< std::string > &args)
void init (int argc, char *argv[])
bool initialized () const
bool isInteractive () const
 Destroys the ServerApplication.
void loadConfiguration (const std::string &path, int priority=PRIO_DEFAULT)
int loadConfiguration (int priority=PRIO_DEFAULT)
Poco::Loggerlogger () const
 Returns the application's configuration.
const char * name () const
const OptionSet & options () const
Poco::UInt16 port () const
 Destroys the EchoServer.
int referenceCount () const
void release () const
 Increments the object's reference count.
int run (int argc, char **argv)
void run ()
void setUnixOptions (bool flag)
const Poco::TimestampstartTime () const
void stopOptionsProcessing ()
 Returns the application uptime.
Poco::Timespan uptime () const
 Returns the application start time (UTC).
 ~EchoServer ()
 Creates the EchoServer.

Static Public Member Functions

static Application & instance ()
 Returns the application's option set.

Protected Member Functions

void defineOptions (OptionSet &options)
void displayHelp ()
bool findFile (Poco::Path &path) const
void handleOption (const std::string &name, const std::string &value)
void init ()
void initialize (Application &self)
int main (const std::vector< std::string > &args)
 Sets the logger used by the application.
void reinitialize (Application &self)
void setLogger (Poco::Logger &logger)
void uninitialize ()
void waitForTerminationRequest ()

Static Protected Member Functions

static void terminate ()

Private Attributes

bool _helpRequested
Poco::Event _ready
Poco::Net::ServerSocket _socket
 Does the work.
bool _stop
Poco::Thread _thread

Friends

class Application
 Destroys the Subsystem.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index