CppWAMP
C++11 client library for the WAMP protocol
wamp::TcpHost Class Reference

Contains TCP host address information, as well as other socket options. More...

#include <cppwamp/tcphost.hpp>

Public Member Functions

 TcpHost (std::string hostName, std::string serviceName, TcpOptions options={}, RawsockMaxLength maxRxLength=defaultMaxRxLength)
 Constructor taking a service string. More...
 
 TcpHost (std::string hostName, unsigned short port, TcpOptions options={}, RawsockMaxLength maxRxLength=defaultMaxRxLength)
 Constructor taking a numeric port number. More...
 
TcpHostwithOptions (TcpOptions options)
 Specifies the socket options to use.
 
TcpHostwithMaxRxLength (RawsockMaxLength length)
 Specifies the maximum length permitted for incoming messages.
 
const std::string & hostName () const
 Obtains the TCP host name.
 
const std::string & serviceName () const
 Obtains the TCP service name, or stringified port number.
 
const TcpOptionsoptions () const
 Obtains the transport options.
 
RawsockMaxLength maxRxLength () const
 Obtains the specified maximum incoming message length.
 
TcpHostwithBroadcast (bool enabled=true)
 The following setters are deprecated. More...
 
TcpHostwithDebug (bool enabled=true)
 Adds the SO_DEBUG socket option. More...
 
TcpHostwithDoNotRoute (bool enabled=true)
 Adds the SO_DONTROUTE socket option. More...
 
TcpHostwithKeepAlive (bool enabled=true)
 Adds the SO_KEEPALIVE socket option. More...
 
TcpHostwithLinger (bool enabled, int timeout)
 Adds the SO_LINGER socket option. More...
 
TcpHostwithOutOfBandInline (bool enabled)
 Adds the SO_OOBINLINE socket option. More...
 
TcpHostwithReceiveBufferSize (int size)
 Adds the SO_RCVBUF socket option. More...
 
TcpHostwithReceiveLowWatermark (int size)
 Adds the SO_RCVLOWAT socket option. More...
 
TcpHostwithReuseAddress (bool enabled=true)
 Adds the SO_REUSEADDR socket option. More...
 
TcpHostwithSendBufferSize (int size)
 Adds the SO_SNDBUF socket option. More...
 
TcpHostwithSendLowWatermark (int size)
 Adds the SO_SNDLOWAT socket option. More...
 
TcpHostwithUnicastHops (int hops)
 Adds the IP_UNICAST_TTL socket option. More...
 
TcpHostwithIpV6Only (bool enabled=true)
 Adds the IP_V6ONLY socket option. More...
 
TcpHostwithNoDelay (bool enabled=true)
 Adds the TCP_NODELAY socket option. More...
 

Static Public Attributes

static constexpr RawsockMaxLength defaultMaxRxLength
 The default maximum length permitted for incoming messages.
 

Related Functions

(Note that these are not member functions.)

template<typename TCodec >
Connector::Ptr connector (AnyIoExecutor exec, TcpHost host)
 Creates a Connector that can establish a TCP raw socket transport. More...
 
template<typename TCodec , typename TExecutionContext >
Connector::Ptr connector (TExecutionContext &context, TcpHost host)
 Creates a Connector that can establish a TCP raw socket transport. More...
 
template<typename TCodec , typename TExecutionContext >
Connector::Ptr connector (TExecutionContext &context, UdsPath path)
 Creates a Connector that can establish a TCP raw socket transport. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ TcpHost() [1/2]

wamp::TcpHost::TcpHost ( std::string  hostName,
std::string  serviceName,
TcpOptions  options = {},
RawsockMaxLength  maxRxLength = defaultMaxRxLength 
)

Constructor taking a service string.

Parameters
hostNameURL or IP of the router to connect to.
serviceNameService name or stringified port number.
optionsSocket options.
maxRxLengthMaximum inbound message length

◆ TcpHost() [2/2]

wamp::TcpHost::TcpHost ( std::string  hostName,
unsigned short  port,
TcpOptions  options = {},
RawsockMaxLength  maxRxLength = defaultMaxRxLength 
)

Constructor taking a numeric port number.

Parameters
hostNameURL or IP of the router to connect to.
portPort number.
optionsTCP socket options.
maxRxLengthMaximum inbound message length

Member Function Documentation

◆ withBroadcast()

TcpHost& wamp::TcpHost::withBroadcast ( bool  enabled = true)
inline

The following setters are deprecated.

Socket options should be passed via the constructor or set via TcpHost::withOptions. Adds the SO_BROADCAST socket option.

Deprecated:

◆ withDebug()

TcpHost& wamp::TcpHost::withDebug ( bool  enabled = true)
inline

Adds the SO_DEBUG socket option.

Deprecated:

◆ withDoNotRoute()

TcpHost& wamp::TcpHost::withDoNotRoute ( bool  enabled = true)
inline

Adds the SO_DONTROUTE socket option.

Deprecated:

◆ withKeepAlive()

TcpHost& wamp::TcpHost::withKeepAlive ( bool  enabled = true)
inline

Adds the SO_KEEPALIVE socket option.

Deprecated:

◆ withLinger()

TcpHost& wamp::TcpHost::withLinger ( bool  enabled,
int  timeout 
)
inline

Adds the SO_LINGER socket option.

Deprecated:

◆ withOutOfBandInline()

TcpHost& wamp::TcpHost::withOutOfBandInline ( bool  enabled)
inline

Adds the SO_OOBINLINE socket option.

Deprecated:

◆ withReceiveBufferSize()

TcpHost& wamp::TcpHost::withReceiveBufferSize ( int  size)
inline

Adds the SO_RCVBUF socket option.

Deprecated:

◆ withReceiveLowWatermark()

TcpHost& wamp::TcpHost::withReceiveLowWatermark ( int  size)
inline

Adds the SO_RCVLOWAT socket option.

Deprecated:

◆ withReuseAddress()

TcpHost& wamp::TcpHost::withReuseAddress ( bool  enabled = true)
inline

Adds the SO_REUSEADDR socket option.

Deprecated:

◆ withSendBufferSize()

TcpHost& wamp::TcpHost::withSendBufferSize ( int  size)
inline

Adds the SO_SNDBUF socket option.

Deprecated:

◆ withSendLowWatermark()

TcpHost& wamp::TcpHost::withSendLowWatermark ( int  size)
inline

Adds the SO_SNDLOWAT socket option.

Deprecated:

◆ withUnicastHops()

TcpHost& wamp::TcpHost::withUnicastHops ( int  hops)
inline

Adds the IP_UNICAST_TTL socket option.

Deprecated:

◆ withIpV6Only()

TcpHost& wamp::TcpHost::withIpV6Only ( bool  enabled = true)
inline

Adds the IP_V6ONLY socket option.

Deprecated:

◆ withNoDelay()

TcpHost& wamp::TcpHost::withNoDelay ( bool  enabled = true)
inline

Adds the TCP_NODELAY socket option.

Deprecated:

Friends And Related Function Documentation

◆ connector() [1/3]

template<typename TCodec >
Connector::Ptr connector ( AnyIoExecutor  exec,
TcpHost  host 
)
related

Creates a Connector that can establish a TCP raw socket transport.

This overload takes an executor that is convertible to the boost::asio::any_io_executor polymorphic wrapper.

Returns
a std::shared_ptr to a Connector
Template Parameters
TCodecThe serialization to use over this transport.
See also
Connector, Json, Msgpack
Parameters
execThe executor to be used by the transport.
hostTCP host address and other socket options.

◆ connector() [2/3]

template<typename TCodec , typename TExecutionContext >
Connector::Ptr connector ( TExecutionContext &  context,
TcpHost  host 
)
related

Creates a Connector that can establish a TCP raw socket transport.

Only participates in overload resolution when isExecutionContext<TExecutionContext>() == true

Returns
a std::shared_ptr to a Connector
Template Parameters
TCodecThe serialization to use over this transport.
TExecutionContextThe given execution context type (deduced).
See also
Connector, Json, Msgpack
Parameters
contextThe I/O context containing the executor to be used by the transport.
hostTCP host address and other socket options.

◆ connector() [3/3]

template<typename TCodec , typename TExecutionContext >
Connector::Ptr connector ( TExecutionContext &  context,
UdsPath  path 
)
related

Creates a Connector that can establish a TCP raw socket transport.

Only participates in overload resolution when isExecutionContext<TExecutionContext>() == true

Returns
a std::shared_ptr to a Connector
Template Parameters
TCodecThe serialization to use over this transport.
TExecutionContextThe given execution context type (deduced).
See also
Connector, Json, Msgpack
Parameters
contextThe I/O context containing the executor to be used by the transport.
pathUnix domain socket path and other socket options.

The documentation for this class was generated from the following files: