- gazebo
- transport
- Connection
TCP/IP Connection. More...
#include <Connection.hh>
Public Types | |
|
typedef boost::function< void(const ConnectionPtr &)> | AcceptCallback |
|
typedef boost::function< void(const std::string &data)> | ReadCallback |
Public Member Functions | |
| Connection () | |
| Constructor. | |
| virtual | ~Connection () |
| Destructor. | |
| bool | Connect (const std::string &host, unsigned short port) |
| Connect to a remote host. | |
| void | Listen (unsigned short port, const AcceptCallback &accept_cb) |
| Start a server that listens on a port. | |
| void | StartRead (const ReadCallback &cb) |
| Start a thread that reads from the connection, and passes new message to the ReadCallback. | |
| void | StopRead () |
| Stop the read loop. | |
| void | Shutdown () |
| Shutdown the socket. | |
| bool | IsOpen () const |
| Return true if the connection is open. | |
| void | Cancel () |
| Cancel all async operations on an open socket. | |
| bool | Read (std::string &data) |
| Read data from the socket. | |
| void | EnqueueMsg (const std::string &_buffer, bool _force=false) |
| Write data to the socket. | |
| std::string | GetLocalURI () const |
| Get the local URI. | |
| std::string | GetRemoteURI () const |
| Get the remote URI. | |
| std::string | GetLocalAddress () const |
| Get the address of this connection. | |
| unsigned short | GetLocalPort () const |
| Get the port of this connection. | |
| std::string | GetRemoteAddress () const |
| Get the remote address. | |
| unsigned short | GetRemotePort () const |
| Get the remote port number. | |
| std::string | GetRemoteHostname () const |
| Get the remote hostname. | |
| std::string | GetLocalHostname () const |
| Get the local hostname. | |
| template<typename Handler > | |
| void | AsyncRead (Handler handler) |
| Peform and asyncronous read. | |
| event::ConnectionPtr | ConnectToShutdown (boost::function< void()> subscriber_) |
| void | DisconnectShutdown (event::ConnectionPtr subscriber_) |
| void | ProcessWriteQueue () |
| Handle on write callbacks. | |
Public Attributes | |
| unsigned int | id |
| unsigned int | writeCount |
TCP/IP Connection.
1.7.5.1