TCP/IP connector.
More...
#include <connector.hpp>
|
using | socket_type = boost::asio::ip::tcp::socket |
|
using | handler = std::function< void(std::error_code, std::shared_ptr< stream >)> |
| Connect completion handler. More...
|
|
◆ socket_type
◆ ip_connector()
irccd::ip_connector::ip_connector |
( |
boost::asio::io_context & |
service, |
|
|
std::string |
hostname, |
|
|
std::string |
port, |
|
|
bool |
ipv4 = true , |
|
|
bool |
ipv6 = true |
|
) |
| |
|
inlinenoexcept |
Construct the TCP/IP connector.
- Precondition
- at least ipv4 or ipv6 must be true
- Parameters
-
service | the I/O context |
hostname | the hostname |
port | the port or service name |
ipv4 | enable IPv4 |
ipv6 | enable IPv6 |
◆ connect() [1/2]
void irccd::ip_connector::connect |
( |
handler |
handler | ) |
|
|
inlinevirtual |
Start asynchronous connect.
Once the client is connected, the original acceptor must be kept until it is destroyed.
- Precondition
- another connect operation must not be running
-
handler != nullptr
- Parameters
-
Implements irccd::connector.
◆ connect() [2/2]
template<typename Socket , typename Handler >
void irccd::ip_connector::connect |
( |
Socket & |
sc, |
|
|
Handler |
handler |
|
) |
| |
|
inline |
Connect to the given socket.
- Parameters
-
sc | the socket type |
handler | the handler |
- Note
- implemented for SocketConnector concept
The documentation for this class was generated from the following file: