#include <thrift_asio_transport.hpp>
|
typedef std::shared_ptr
< boost::asio::ip::tcp::socket > | socket_ptr |
| | a shared_ptr to a tcp socket
|
| |
thrift transport that employs a boost::asio::socket.
If you want name resolution, it might be easier to use thrift_asio_client_transport
enum to represent the state-machine of the connection
| Enumerator |
|---|
| CLOSED |
the transport is closed
|
| CONNECTING |
the transport is currently connecting
|
| RESOLVING |
we're currently trying to resolve host_name:service_name
|
| OPEN |
the transport is open and ready for communication
|
| virtual const std::string betabugs::networking::thrift_asio_transport::getOrigin |
( |
| ) |
|
|
inlineoverridevirtual |
Returns the origin of the transports call. The value depends on the transport used. An IP based transport for example will return the IP address of the client making the request. If the transport doesn't know the origin Unknown is returned.
The returned value can be used in a log message for example
| bool betabugs::networking::thrift_asio_transport::isClosed |
( |
| ) |
|
|
inline |
Checks wether this transport is closed.
- Returns
- true, if the transport is closed, false if the connection is open or name resolution is in progress.
| uint32_t betabugs::networking::thrift_asio_transport::read |
( |
uint8_t * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
|
inline |
Attempt to read up to the specified number of bytes into the string.
This does not block if data is available. But it does block, if there is not enough data. If you don't want to block, use available_bytes() to check if there's enough data.
- Parameters
-
| buf | Reference to the location to write the data |
| len | How many bytes to read |
- Returns
- How many bytes were actually read
| void betabugs::networking::thrift_asio_transport::write |
( |
const uint8_t * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
|
inline |
asynchronously sends len bytes from buf.
In case of error, the event_handler::on_error will be invoked.
- Parameters
-
| buf | The data to write out |
| len | number of bytes to read from buf |
The documentation for this class was generated from the following file: