Goby v2
Public Types | Public Member Functions | Friends | List of all members
goby::util::TCPServer Class Reference

provides a basic TCP server for line by line text based communications to a one or more remote TCP clients More...

#include <goby/util/linebasedcomms/tcp_server.h>

Inheritance diagram for goby::util::TCPServer:
Inheritance graph
[legend]

Public Types

typedef std::string Endpoint
 
- Public Types inherited from goby::util::LineBasedInterface
enum  AccessOrder { NEWEST_FIRST, OLDEST_FIRST }
 

Public Member Functions

 TCPServer (unsigned port, const std::string &delimiter="\r\n")
 create a TCP server More...
 
void close (const Endpoint &endpoint)
 
std::string local_endpoint ()
 string representation of the local endpoint (e.g. 192.168.1.105:54230
 
const std::map< Endpoint, boost::shared_ptr< TCPConnection > > & connections ()
 
- Public Member Functions inherited from goby::util::LineBasedInterface
 LineBasedInterface (const std::string &delimiter)
 
void start ()
 
void close ()
 
bool active ()
 
void sleep (int sec)
 
bool readline (std::string *s, AccessOrder order=OLDEST_FIRST)
 returns string line (including delimiter) More...
 
bool readline (protobuf::Datagram *msg, AccessOrder order=OLDEST_FIRST)
 
void write (const std::string &s)
 
void write (const protobuf::Datagram &msg)
 
void clear ()
 
void set_delimiter (const std::string &s)
 
std::string delimiter () const
 
boost::asio::io_service & io_service ()
 

Friends

class TCPConnection
 
class LineBasedConnection< boost::asio::ip::tcp::socket >
 

Additional Inherited Members

- Protected Member Functions inherited from goby::util::LineBasedInterface
void set_active (bool active)
 
std::string & delimiter ()
 
std::deque< goby::util::protobuf::Datagram > & in ()
 
boost::mutex & in_mutex ()
 
- Protected Attributes inherited from goby::util::LineBasedInterface
std::string delimiter_
 
boost::asio::io_service io_service_
 
std::deque< protobuf::Datagramin_
 
boost::mutex in_mutex_
 

Detailed Description

provides a basic TCP server for line by line text based communications to a one or more remote TCP clients

Definition at line 49 of file tcp_server.h.

Constructor & Destructor Documentation

goby::util::TCPServer::TCPServer ( unsigned  port,
const std::string &  delimiter = "\r\n" 
)
inline

create a TCP server

Parameters
portport of the server (use 50000+ to avoid problems with special system ports)
delimiterstring used to split lines

Definition at line 56 of file tcp_server.h.


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