Goby v2
|
provides a basic TCP client for line by line text based communications to a remote TCP server More...
#include <goby/util/linebasedcomms/tcp_client.h>
Public Member Functions | |
TCPClient (const std::string &server, unsigned port, const std::string &delimiter="\r\n", int retry_interval=10) | |
create a TCPClient More... | |
boost::asio::ip::tcp::socket & | socket () |
std::string | local_endpoint () |
string representation of the local endpoint (e.g. 192.168.1.105:54230 | |
std::string | remote_endpoint () |
string representation of the remote endpoint, (e.g. 192.168.1.106:50000 | |
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 () |
Public Member Functions inherited from goby::util::LineBasedConnection< boost::asio::ip::tcp::socket > | |
LineBasedConnection (LineBasedInterface *interface) | |
void | read_start () |
void | write_start () |
void | read_complete (const boost::system::error_code &error) |
void | write_complete (const boost::system::error_code &error) |
std::deque< protobuf::Datagram > & | out () |
Friends | |
class | TCPConnection |
class | LineBasedConnection< boost::asio::ip::tcp::socket > |
Additional Inherited Members | |
Public Types inherited from goby::util::LineBasedInterface | |
enum | AccessOrder { NEWEST_FIRST, OLDEST_FIRST } |
Protected Member Functions inherited from goby::util::LineBasedClient< boost::asio::ip::tcp::socket > | |
LineBasedClient (const std::string &delimiter, int retry_interval=10) | |
void | do_start () |
void | do_write (const protobuf::Datagram &line) |
void | do_close (const boost::system::error_code &error) |
void | socket_close (const boost::system::error_code &error) |
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::Datagram > | in_ |
boost::mutex | in_mutex_ |
provides a basic TCP client for line by line text based communications to a remote TCP server
Definition at line 34 of file tcp_client.h.
goby::util::TCPClient::TCPClient | ( | const std::string & | server, |
unsigned | port, | ||
const std::string & | delimiter = "\r\n" , |
||
int | retry_interval = 10 |
||
) |
create a TCPClient
server | domain name or IP address of the remote server |
port | port of the remote server |
delimiter | string used to split lines |
Definition at line 28 of file tcp_client.cpp.