PLCnext API Documentation 24.6.0.58
|
Interface to realize TLS Connection over TCP More...
#include <TlsSocket2.hpp>
Public Types | |
using | Ptr = std::shared_ptr< TlsSocket2 > |
using | Certificate = Arp::System::Commons::Security::Certificate |
using | VerifyHandler = delegate< void(bool &, TlsVerificationError &, int, const Certificate *)> |
Used a for AddVerifyHandler Note: certificate is optional and can be nullptr, must be checked before use | |
using | AlertHandler = delegate< void(TlsAlertType, TlsAlertLevel)> |
Public Member Functions | |
TlsSocket2 (SocketType type, SocketDomain domain, SocketBlockingMode blockingMode) | |
TlsSocket2 (SocketType type, SocketDomain domain, SocketBlockingMode blockingMode, TlsOptions options) | |
TlsSocket2 (const TlsSocket2 &arg)=delete | |
TlsSocket2 (TlsSocket2 &&arg) noexcept | |
TlsSocket2 (Socket::Ptr pSocket, TlsContextPtr pContext, bool isInitialized) | |
TlsSocket2 & | operator= (const TlsSocket2 &arg)=delete |
TlsSocket2 & | operator= (TlsSocket2 &&arg) noexcept |
SocketType | GetSocketType (void) |
Returns the type of the socket. More... | |
SocketDomain | GetSocketDomain (void) |
Returns the type of the socket. More... | |
bool | IsBlocking (void) |
Checks if the socket is in blocking mode. More... | |
bool | IsConnected (void) |
Checks if the socket is in blocking mode. More... | |
bool | IsTlsConnected (void) |
Checks if a TLS connection is established with a remote peer. More... | |
IpAddress | GetRemoteIpAddress (void) |
Checks if this socket is connected with a remote peer. More... | |
int | GetRemotePort (void) |
If this socket is connected this method returns the port of the connection. More... | |
Ptr | Accept (IpAddress &ip4address, int &port, SocketError &error) |
Accepts a pending connection request. More... | |
SocketError | Bind (const IpAddress &ip4Address, int port) |
Binds the socket to a specific address and port combination. More... | |
SocketError | Bind2 (const IpAddress &ip4Address, int &port) |
Binds the socket to a specific address and port combination. More... | |
SocketError | Listen (size_t backlog) |
Marks this socket as a passive socket that accepts incoming connection requests. More... | |
SocketError | Connect (const IpAddress &ip4Address, int port) |
Tries to connect with a remote socket. More... | |
SocketError | Shutdown (void) |
Shuts down a full-duplex connection. More... | |
SocketError | Shutdown (ShutdownMode mode) |
Shuts down a full-duplex connection. More... | |
SocketError | Close (void) |
Closes the socket. This ends all communication on the socket. More... | |
int | Send (const void *pBuffer, size_t length, SocketError &error) |
Transmit data over the socket that is in a connected state. More... | |
int | Receive (void *pBuffer, size_t length, SocketError &error) |
Reads data from connected socket. More... | |
bool | Select (SelectMode mode, Microseconds timeout, SocketError &error) |
Checks if an i/o operation can be performed without blocking the calling thread. More... | |
int | Poll (PollMode mode, Milliseconds timeout, SocketError &error) |
Checks if an i/o operation can be processed without blocking. More... | |
SocketError | SetSocketOption (SocketOptionName optionName, const void *optionValue, size_t optionLength) |
Sets a single option on the socket. More... | |
SocketError | GetSocketOption (SocketOptionName optionName, void *optionValue, size_t *optionLength) |
Returns current value of queried socket option. More... | |
SocketError | SetOptionReuseAddress (bool enabled) |
Enables/Disables the reuse-address option for this socket. More... | |
SocketError | GetOptionReuseAddress (bool &enabled) |
Checks if reuse-address is enabled. More... | |
SocketError | SetOptionKeepAlive (bool enabled) |
Enables/Disables the keep-alive option for this socket. More... | |
SocketError | GetOptionKeepAlive (bool &enabled) |
Checks if keep-alive is enabled. More... | |
SocketError | SetOptionBroadcast (bool enabled) |
Enables/Disables broadcast for this socket. More... | |
SocketError | GetOptionBroadcast (bool &enabled) |
Checks if broadcast is enabled. More... | |
SocketError | SetOptionNoDelay (bool enabled) |
Enables/Disables no-delay for this socket. More... | |
SocketError | GetOptionNoDelay (bool &enabled) |
Checks if no-delay is enabled. More... | |
SocketError | SetOptionLinger (bool enable, size_t timeout) |
Sets the amount of time a socket resides in TIME_WAIT state after active close. More... | |
SocketError | GetOptionLinger (bool &enable, size_t &timeout) |
Returns the current linger options. For more information see Arp::System::Commons::Net::Socket::SetOptionLinger More... | |
SocketError | SetOptionUserTimeout (size_t timeout_ms) |
Sets the retransmission timeout of a socket. This only works on Linux. More... | |
SocketError | GetOptionUserTimeout (size_t &timeout_ms) |
Gets the retransmission timeout of a socket. This only works on Linux. For more information see Arp::System::Commons::Net::Socket::SetOptionUserTimeout More... | |
SocketError | SetOptionKeepAliveIdleTime (int seconds) |
Sets the time that the socket needs to be idle for, before the Keep Alive mechanism can start if the KeepAlive SocketOption is set to true. More... | |
SocketError | GetOptionKeepAliveIdleTime (int &seconds) |
Gets the time that the socket needs to be idle for, before the Keep Alive mechanism can start if the KeepAlive SocketOption is set to true. For more information see Arp::System::Commons::Net::Socket::SetOptionKeepAliveIdleTime More... | |
SocketError | SetOptionKeepAliveProbeInterval (int seconds) |
Sets the interval time in between each Keep Alive probe, if the KeepAlive SocketOption is set to true. More... | |
SocketError | GetOptionKeepAliveProbeInterval (int &seconds) |
Gets the interval time in between each Keep Alive probe, if the KeepAlive SocketOption is set to true. For more information see Arp::System::Commons::Net::Socket::SetOptionKeepAliveProbeInterval More... | |
SocketError | SetOptionKeepAliveProbeCount (int probeCount) |
Sets the amount of probes to be sent, if the KeepAlive SocketOption is set to true. More... | |
SocketError | GetOptionKeepAliveProbeCount (int &probeCount) |
Gets the amount of probes to be sent, if the KeepAlive SocketOption is set to true. For more information see Arp::System::Commons::Net::Socket::SetOptionKeepAliveProbeCount More... | |
SocketError | SetOptionBlocking (bool enable) |
Enables/disables the blocking mode of this socket.. More... | |
SocketError | InitClient (const String &trustStoreName, const String &identityStoreName, const String &hostName) |
SocketError | InitServer (const String &identityStoreName, const String &trustStoreName="") |
void | SetCipherList (const String &cipherList) |
SocketError | RenegotiateSession () |
SocketError | UpdateSessionKeys (bool requestUpdate=true) |
SocketError | GetPeerCertificate (Certificate &certificate) |
SteadyTimePoint | GetLastRenegotionTime (void) |
Queries the last timepoint when a TLS renegotiation was performed More... | |
SteadyTimePoint | GetLastKeyUpdateTime (void) |
Queries the last timepoint when a TLS session resumption (TLS 1.2) or key update (TLS 1.3) was performed More... | |
void | AddVerifyHandler (const VerifyHandler &handler) |
Adds a handler which is called during certificate validation ot the peer certificate More... | |
void | RemoveVerifyHandler (const VerifyHandler &handler) |
Removes a VerifyHandler again | |
void | AddAlertReceivedHandler (const AlertHandler &handler) |
Adds a handler which is called when a TLS alert is received from the peer | |
void | RemoveAlertReceivedHandler (const AlertHandler &handler) |
Removes a AlertReceived handler again | |
void | AddAlertSendHandler (const AlertHandler &handler) |
Adds a handler which is called when a TLS alert is send to the peer | |
void | RemoveAlertSendHandler (const AlertHandler &handler) |
Removes a AlertSend handler again | |
Impl & | GetImpl (void) |
const Impl & | GetImpl (void) const |
Static Public Member Functions | |
static String | GetTlsVerificationErrorString (const TlsVerificationError &error) |
Interface to realize TLS Connection over TCP
This class can be use to provide an TLS Server or an TLS Client Socket Both Server and optional Client Certificates are supported
To provide the identity for a TLS Server or client a IdentityStore can be referenced by name remote certificates are checked against a TrustStore referenced by name
Ptr Arp::System::Commons::Net::TlsSocket2::Accept | ( | IpAddress & | ip4address, |
int & | port, | ||
SocketError & | error | ||
) |
Accepts a pending connection request.
Before a socket can accept connection requests, it must be Bind with an address and must be set to Listen state.
If no connection request is pending and the socket is in
Currently only ip v4 addresses are supported. The address must be encoded in a single 32 bit value. For an example how to encode the address see the example in the class description.
ip4address | holds the 32 bit encoded ip v4 address of the connected peer socket. |
port | Holds the port number of the connected peer socket. |
error | Holds error code in case the method returns nullptr. |
void Arp::System::Commons::Net::TlsSocket2::AddVerifyHandler | ( | const VerifyHandler & | handler | ) |
Adds a handler which is called during certificate validation ot the peer certificate
This handler can be used to:
SocketError Arp::System::Commons::Net::TlsSocket2::Bind | ( | const IpAddress & | ip4Address, |
int | port | ||
) |
Binds the socket to a specific address and port combination.
Currently only ip v4 addresses are supported. The address must be encoded in a single 32 bit value. For an example how to encode the address see the example in the class description.
To bind this socket to all local interfaces, 0 has to be assigned to parameter ip4Address.
ip4Address | IP v4 based address to connect to. |
port | Port number to connect with. |
SocketError Arp::System::Commons::Net::TlsSocket2::Bind2 | ( | const IpAddress & | ip4Address, |
int & | port | ||
) |
Binds the socket to a specific address and port combination.
bind2 returns the actual port used by this socket in the port parameter in contrast to bind i.e. use bind(ip, 0) to let the os choose the port to use, after the call port will contain the port choosed by the os.
Currently only ip v4 addresses are supported. The address must be encoded in a single 32 bit value. For an example how to encode the address see the example in the class description.
To bind this socket to all local interfaces, 0 has to be assigned to parameter ip4Address.
ip4Address | IP v4 based address to connect to. |
port | Port number to connect with. |
SocketError Arp::System::Commons::Net::TlsSocket2::Close | ( | void | ) |
Closes the socket. This ends all communication on the socket.
After Close() no further calls (i.e. a new connect()) on this socket are possible thus the socket instance must be destroyed.
SocketError Arp::System::Commons::Net::TlsSocket2::Connect | ( | const IpAddress & | ip4Address, |
int | port | ||
) |
Tries to connect with a remote socket.
Currently only ip v4 addresses are supported. The address must be encoded in a single 32 bit value. For an example how to encode the address see the example in the class description.
ip4Address | IP v4 based address to connect to. |
port | Port number to connect with. |
SteadyTimePoint Arp::System::Commons::Net::TlsSocket2::GetLastKeyUpdateTime | ( | void | ) |
Queries the last timepoint when a TLS session resumption (TLS 1.2) or key update (TLS 1.3) was performed
whenever a session resumption or key update is performed (initiated by this socket or the peer) for this TLS connection the timepoint is stored. with this method the last timepoint can be queried
SteadyTimePoint Arp::System::Commons::Net::TlsSocket2::GetLastRenegotionTime | ( | void | ) |
Queries the last timepoint when a TLS renegotiation was performed
whenever a renogotiation is performed (initiated by this socket or the peer) for this TLS connection the timepoint is stored. with this method the last timepoint can be queried
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionBroadcast | ( | bool & | enabled | ) |
Checks if broadcast is enabled.
See SetOptionBroadcast for more information.
enabled | Container for current option state. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionKeepAlive | ( | bool & | enabled | ) |
Checks if keep-alive is enabled.
See SetOptionKeepAlive for more information.
enabled | Container for current option state. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionKeepAliveIdleTime | ( | int & | seconds | ) |
Gets the time that the socket needs to be idle for, before the Keep Alive mechanism can start if the KeepAlive SocketOption is set to true. For more information see Arp::System::Commons::Net::Socket::SetOptionKeepAliveIdleTime
seconds | Gets the required Keep Alive socket idle time duration in seconds if Keep Alive is enabled. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionKeepAliveProbeCount | ( | int & | probeCount | ) |
Gets the amount of probes to be sent, if the KeepAlive SocketOption is set to true. For more information see Arp::System::Commons::Net::Socket::SetOptionKeepAliveProbeCount
probeCount | Gets the amount of Keep Alive probes to be sent if Keep Alive is enabled. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionKeepAliveProbeInterval | ( | int & | seconds | ) |
Gets the interval time in between each Keep Alive probe, if the KeepAlive SocketOption is set to true. For more information see Arp::System::Commons::Net::Socket::SetOptionKeepAliveProbeInterval
seconds | Gets the interval in seconds in between Keep Alive probes if Keep Alive is enabled. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionLinger | ( | bool & | enable, |
size_t & | timeout | ||
) |
Returns the current linger options. For more information see Arp::System::Commons::Net::Socket::SetOptionLinger
enable | True if linger option is active, otherwise false. |
timeout | Holds current timeout value in seconds if linger is activated on this socket. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionNoDelay | ( | bool & | enabled | ) |
Checks if no-delay is enabled.
See SetOptionNoDelay for more information.
enabled | Container for current option state. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionReuseAddress | ( | bool & | enabled | ) |
Checks if reuse-address is enabled.
See SetOptionReuseAddress for more information
enabled | Container for current option state. |
SocketError Arp::System::Commons::Net::TlsSocket2::GetOptionUserTimeout | ( | size_t & | timeout_ms | ) |
Gets the retransmission timeout of a socket. This only works on Linux. For more information see Arp::System::Commons::Net::Socket::SetOptionUserTimeout
timeout_ms | Holds the current retransmission timeout value in milliseconds if it has been set on this socket. |
IpAddress Arp::System::Commons::Net::TlsSocket2::GetRemoteIpAddress | ( | void | ) |
Checks if this socket is connected with a remote peer.
int Arp::System::Commons::Net::TlsSocket2::GetRemotePort | ( | void | ) |
If this socket is connected this method returns the port of the connection.
The port number is returned in host byte order, not in network byte order.
SocketDomain Arp::System::Commons::Net::TlsSocket2::GetSocketDomain | ( | void | ) |
Returns the type of the socket.
SocketError Arp::System::Commons::Net::TlsSocket2::GetSocketOption | ( | SocketOptionName | optionName, |
void * | optionValue, | ||
size_t * | optionLength | ||
) |
Returns current value of queried socket option.
optionName | Name of option where current value is queried. |
optionValue | Pointer to buffer where current socket option value is to be stored. |
optionLength | Value-Result argument. Must be initialized to byte size of buffer pointed to by optionValue. Holds amount of bytes set in buffer optionValue after call returned. |
SocketType Arp::System::Commons::Net::TlsSocket2::GetSocketType | ( | void | ) |
Returns the type of the socket.
SocketError Arp::System::Commons::Net::TlsSocket2::InitClient | ( | const String & | trustStoreName, |
const String & | identityStoreName, | ||
const String & | hostName | ||
) |
summary>Initializes this TLS socket in server mode. This method must be called before accepting connections with Accept
param name="identityStoreName"> name of the IdentityStore to use for the server identity (certificcate) the referenced identity store is used as the server certificate /param>
param name="trustStoreName"> optional name of the truststore which should be used to verify the client certificate if the client certificate should not be checked the paramter can be omitted or set to "" /param>
SocketError Arp::System::Commons::Net::TlsSocket2::InitServer | ( | const String & | identityStoreName, |
const String & | trustStoreName = "" |
||
) |
summary>Sets the supported ciphers of this socket which are used during connection negotiation
also see: https://www.openssl.org/docs/man1.0.2/apps/ciphers.html if this method is called with an empty String, SSL_CTX_set_cipher_list is not called for this TLS connection and the OpenSSL default is used.
param name="cipherList"> The String of ciphers which should be supported. Format of the string as specified by OpenSSL. /param>
bool Arp::System::Commons::Net::TlsSocket2::IsBlocking | ( | void | ) |
Checks if the socket is in blocking mode.
bool Arp::System::Commons::Net::TlsSocket2::IsConnected | ( | void | ) |
Checks if the socket is in blocking mode.
bool Arp::System::Commons::Net::TlsSocket2::IsTlsConnected | ( | void | ) |
Checks if a TLS connection is established with a remote peer.
SocketError Arp::System::Commons::Net::TlsSocket2::Listen | ( | size_t | backlog | ) |
Marks this socket as a passive socket that accepts incoming connection requests.
A socket in listening state features an internal queue where incoming connection requests are stored until they are processed by an Accept invocation. The maximal capacity of this queue is determined by the parameter backlog. If a connection request arrives while the queue is filled, the client may receive an error telling that the connection is refused or, if the utilized protocol allows retransmissions, the request may be ignored so that a consecutive reattempt to connnect may succeed.
backlog | Defines the maximum number of pending connection requests. |
int Arp::System::Commons::Net::TlsSocket2::Poll | ( | PollMode | mode, |
Milliseconds | timeout, | ||
SocketError & | error | ||
) |
Checks if an i/o operation can be processed without blocking.
mode | Specifies the i/o operation to be checked. |
timeout | Specifies the timeout to wait for the socket to get ready for the i/o operation. If set to zero, the call will return immediately. Milliseconds(-1) determines infinite. |
error | The resulting socket error, if any error occur. |
1
if the specified i/o operation might be processed without blocking. 0
if this operation timed out. -1
if any error occurs. Check the error to get more infos about the error. If the socket was closed local or remote, the error is <cref name="SocketError::ConnectionReset" >. int Arp::System::Commons::Net::TlsSocket2::Receive | ( | void * | pBuffer, |
size_t | length, | ||
SocketError & | error | ||
) |
Reads data from connected socket.
pBuffer | Pointer to buffer where read data can be stored. |
length | Capacity in bytes of buffer pBuffer. |
error | Container variable holding error code after call returned. |
SocketError Arp::System::Commons::Net::TlsSocket2::RenegotiateSession | ( | ) |
summary>Update the keys for the current established TLS session
For TLS 1.2 this will be done with a SessionResumption (which might also involve a Renegotiation if the session can not be resumed) The requestUpdate parameter is ignored for TLS1.2
For TLS 1.3 a KeyUdpate will be done, if requestUpdate is true the peer will be ask to also update the keys if requestUpdate is false the keys will be updated and the peer is imformed about the update param name="requestUpdate"> Wether to request the update from the peer (only for TLS1.3), ignored for TLS 1.2 /param>
bool Arp::System::Commons::Net::TlsSocket2::Select | ( | SelectMode | mode, |
Microseconds | timeout, | ||
SocketError & | error | ||
) |
Checks if an i/o operation can be performed without blocking the calling thread.
mode | Determines the i/o operation to be checked. |
timeout | Specifies the time to wait for the socket to be ready for the i/o operation. If set to zero, the call will return immediately. |
error | Container variable holding error code after call returned. |
int Arp::System::Commons::Net::TlsSocket2::Send | ( | const void * | pBuffer, |
size_t | length, | ||
SocketError & | error | ||
) |
Transmit data over the socket that is in a connected state.
pBuffer | Pointer to buffer containing serialized data to be send. |
length | Amount of bytes to be send. |
error | Container variable holding error code after call returned. |
void Arp::System::Commons::Net::TlsSocket2::SetCipherList | ( | const String & | cipherList | ) |
summary>Triggeres a complete renegotion of the esstablished TLS session
Can be only used for TLS 1.2 connections.
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionBlocking | ( | bool | enable | ) |
Enables/disables the blocking mode of this socket..
enable | true if the blocking mode shall be enabled, otherwise false . |
summary>Initializes this TLS socket in client mode. This method must be called before connecting to a server
param name="trustStoreName"> name of the TrustStore to use to verify the remote server certificate /param>
param name="identityStoreName"> name of the IdentityStore to use for the client identity the references store is used to authenticate against the server if client authentication should not be used the identityStoreName can be set to "" /param>
param name="hostName"> the hostname (or ip-address) which should be used while verifying the server certificate. the hostname if compared against the Subject entry of the server certificate if the hostname should not be checked the hostName can be set to "" /param>
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionBroadcast | ( | bool | enabled | ) |
Enables/Disables broadcast for this socket.
This option is only valid for datagram sockets and can be used to enable the sending of packets to broadcast addresses.
enabled | Set to tro true activate option, otherwise set to false. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionKeepAlive | ( | bool | enabled | ) |
Enables/Disables the keep-alive option for this socket.
Enables the sending of keep-alive probes to remote peers to check if a connection is still up if no data was transmitted for a while.
This option is only valid for connection-based sockets.
enabled | Set to true to activate option, otherwise set to false. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionKeepAliveIdleTime | ( | int | seconds | ) |
Sets the time that the socket needs to be idle for, before the Keep Alive mechanism can start if the KeepAlive SocketOption is set to true.
seconds | Sets the required Keep Alive socket idle time duration in seconds if Keep Alive is set to true. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionKeepAliveProbeCount | ( | int | probeCount | ) |
Sets the amount of probes to be sent, if the KeepAlive SocketOption is set to true.
probeCount | Sets the amount of Keep Alive probes to be sent if Keep Alive is enabled. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionKeepAliveProbeInterval | ( | int | seconds | ) |
Sets the interval time in between each Keep Alive probe, if the KeepAlive SocketOption is set to true.
seconds | Sets the interval in seconds in between Keep Alive probes if Keep Alive is enabled. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionLinger | ( | bool | enable, |
size_t | timeout | ||
) |
Sets the amount of time a socket resides in TIME_WAIT state after active close.
The port of a connection that is activly closed, i.e. first calls Arp::System::Commons::Net::Socket::Close will reside in a state called TIME_WAIT for a specific amount of time. This prevents subsequently delivered packages to be considered to belong to a potential new established connection using the same port.
The time a port is in TIME_WAIT state can be adjusted using this method. A smaller timeout can be of interest if the system has to manage a lot of connections that only are active for a small amount of time. In this case a small timeout will prevent a lot of socket residing in TIME_WAIT and are therefore unavailable for creation of new connections.
enable | Set to true to activate new linger timeout, false otherwise. |
timeout | The new linger timeout in seconds. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionNoDelay | ( | bool | enabled | ) |
Enables/Disables no-delay for this socket.
If this option is enabled packets are not buffered by the TCP stack stack to optimize the network usage by only sending sufficiently large amount of data. Instead even small packets are send immediately over the network.
enabled | Set to tro true activate option, otherwise set to false. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionReuseAddress | ( | bool | enabled | ) |
Enables/Disables the reuse-address option for this socket.
Activating this option changes the validation process for socket bindings. If the option is disabled and one port is for example bound to 0.0.0.0:21 (any local address and port 21) another port can not be bound to 192.168.0.4:21 because the wildcard IP address 0.0.0.0 conflicts with the other address. If the option is enabled, bounding the second socket will succeed.
enabled | Set to true to enable the option, otherwise set to false. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetOptionUserTimeout | ( | size_t | timeout_ms | ) |
Sets the retransmission timeout of a socket. This only works on Linux.
By default, in the case of a retransmission, the system will use the global "tcp_retries2" value in a backoff algorithm (Doubles each try) in order to try and resend its data. Generally this can last for around 13-30 minutes, depending on the "tcl_retries2" value.
During this time, the socket will not be able to enter an idle state, therefore blocking the KeepAlive mechanism until after the retransmission phase has completed, even if the connection is no longer valid.
This SocketOption enables a timeout that will override the maximum length the rentransmission phase can last, on order to be able to utilize KeepAlive to detect a broken connection before the long retransmission phase ends.
It is generally adviced that the timeout should be set slightly lower than the total time the KeepAlive process takes, to ensure that both retransmission occurs and KeepAlive probes are able to be sent.
timeout_ms | Sets a new retransmission timeout in milliseconds. |
SocketError Arp::System::Commons::Net::TlsSocket2::SetSocketOption | ( | SocketOptionName | optionName, |
const void * | optionValue, | ||
size_t | optionLength | ||
) |
Sets a single option on the socket.
optionName | Name of option ot be set. |
optionValue | Pointer to additional data for socket option. |
optionLength | Byte size of buffer pointed to by optionValue. |
SocketError Arp::System::Commons::Net::TlsSocket2::Shutdown | ( | ShutdownMode | mode | ) |
Shuts down a full-duplex connection.
After the shutdown has been called, further reception and transmission on the socket is disallowed.
mode | Specifies if read or write operations should be shutdown. |
SocketError Arp::System::Commons::Net::TlsSocket2::Shutdown | ( | void | ) |
Shuts down a full-duplex connection.
After the shutdown has been called, further reception and transmission on the socket is disallowed.
SocketError Arp::System::Commons::Net::TlsSocket2::UpdateSessionKeys | ( | bool | requestUpdate = true | ) |
summary>Retrieves the certificate of the TLS peer
Retrieves the peer certificate of this socket. This is the client certificate a client used for TLS client authentication in case of a server socket This is the certificate of the server the client is connected to in case of a client socket
param name="certificate"> reference to a Certificate object which will be filled in case the peer certificate can be received /param>