a transport using TCP socket
More...
#include <ndn-cxx/transport/tcp-transport.hpp>
a transport using TCP socket
Definition at line 44 of file tcp-transport.hpp.
◆ ErrorCallback
◆ ReceiveCallback
◆ TcpTransport()
ndn::TcpTransport::TcpTransport |
( |
const std::string & |
host, |
|
|
const std::string & |
port = "6363" |
|
) |
| |
|
explicit |
◆ ~TcpTransport()
ndn::TcpTransport::~TcpTransport |
( |
| ) |
|
|
overridedefault |
◆ close()
void ndn::TcpTransport::close |
( |
| ) |
|
|
overridevirtual |
◆ connect()
void ndn::TcpTransport::connect |
( |
boost::asio::io_service & |
ioService, |
|
|
ReceiveCallback |
receiveCallback |
|
) |
| |
|
overridevirtual |
Asynchronously open the connection.
- Parameters
-
ioService | io_service to create socket on |
receiveCallback | callback function when a TLV block is received; must not be empty |
- Exceptions
-
boost::system::system_error | connection cannot be established |
Reimplemented from ndn::Transport.
Definition at line 81 of file tcp-transport.cpp.
◆ create()
shared_ptr< TcpTransport > ndn::TcpTransport::create |
( |
const std::string & |
uri | ) |
|
|
static |
Create transport with parameters defined in URI.
- Exceptions
-
Definition at line 41 of file tcp-transport.cpp.
◆ isConnected()
bool ndn::Transport::isConnected |
( |
| ) |
const |
|
inlinenoexceptinherited |
- Return values
-
true | connection has been established |
false | connection is not yet established or has been closed |
Definition at line 98 of file transport.hpp.
◆ isReceiving()
bool ndn::Transport::isReceiving |
( |
| ) |
const |
|
inlinenoexceptinherited |
- Return values
-
true | incoming packets are expected, the receive callback will be invoked |
false | incoming packets are not expected, the receive callback will not be invoked |
Definition at line 107 of file transport.hpp.
◆ pause()
void ndn::TcpTransport::pause |
( |
| ) |
|
|
overridevirtual |
pause the transport
- Postcondition
- the receive callback will not be invoked
- Note
- This operation has no effect if transport has been paused, or when connection is being established.
Implements ndn::Transport.
Definition at line 118 of file tcp-transport.cpp.
◆ resume()
void ndn::TcpTransport::resume |
( |
| ) |
|
|
overridevirtual |
resume the transport
- Postcondition
- the receive callback will be invoked
- Note
- This operation has no effect if transport is not paused, or when connection is being established.
Implements ndn::Transport.
Definition at line 127 of file tcp-transport.cpp.
◆ send() [1/2]
void ndn::TcpTransport::send |
( |
const Block & |
wire | ) |
|
|
overridevirtual |
◆ send() [2/2]
void ndn::TcpTransport::send |
( |
const Block & |
header, |
|
|
const Block & |
payload |
|
) |
| |
|
overridevirtual |
send two memory blocks through the transport
Scatter/gather API is utilized to send two non-consecutive memory blocks together (as part of the same message in datagram-oriented transports).
Implements ndn::Transport.
Definition at line 102 of file tcp-transport.cpp.
◆ detail::StreamTransportImpl< TcpTransport, boost::asio::ip::tcp >
◆ m_ioService
boost::asio::io_service* ndn::Transport::m_ioService = nullptr |
|
protectedinherited |
◆ m_isConnected
bool ndn::Transport::m_isConnected = false |
|
protectedinherited |
◆ m_isReceiving
bool ndn::Transport::m_isReceiving = false |
|
protectedinherited |
◆ m_receiveCallback