A transport that uses a TCP socket for communication.
More...
#include <ndn-cxx/transport/tcp-transport.hpp>
A transport that uses a TCP socket for communication.
Definition at line 44 of file tcp-transport.hpp.
◆ ReceiveCallback
◆ State
Enumerator |
---|
CLOSED | |
CONNECTING | |
RUNNING | |
PAUSED | |
Definition at line 47 of file transport.hpp.
◆ 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_context & |
ioCtx, |
|
|
ReceiveCallback |
receiveCallback |
|
) |
| |
|
overridevirtual |
Asynchronously open the connection.
- Parameters
-
ioCtx | io_context 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 42 of file tcp-transport.cpp.
◆ getState()
State ndn::Transport::getState |
( |
| ) |
const |
|
inlinenoexceptinherited |
Return the current state of the transport.
Definition at line 103 of file transport.hpp.
◆ pause()
void ndn::TcpTransport::pause |
( |
| ) |
|
|
overridevirtual |
Pause the transport, canceling all pending operations.
- Postcondition
- the receive callback will not be invoked
- Note
- This operation has no effect if the transport has been paused, or when the connection is being established.
Implements ndn::Transport.
Definition at line 109 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 the transport is not paused, or when the connection is being established.
Implements ndn::Transport.
Definition at line 118 of file tcp-transport.cpp.
◆ send()
void ndn::TcpTransport::send |
( |
const Block & |
block | ) |
|
|
overridevirtual |
◆ setState()
void ndn::Transport::setState |
( |
State |
state | ) |
|
|
inlineprotectednoexceptinherited |
◆ detail::StreamTransportImpl< TcpTransport, boost::asio::ip::tcp >
◆ m_ioCtx
boost::asio::io_context* ndn::Transport::m_ioCtx = nullptr |
|
protectedinherited |
◆ m_receiveCallback