Implements a secure (SSL/TLS) TCP socket.
The CYITCPSecureSocket class provides methods to send and receive data over a TCP/IP connection in a secure manner by using the SSL protocol. Modern SSL v3.1 has been renamed to TLS v1.1 and the version used is determined by the server but CYITCPSecureSocket is restricted to TLS v1.1 and higher.
#include <network/YiTCPSecureSocket.h>
Public Member Functions | |
virtual | ~CYITCPSecureSocket () |
virtual IYISocket::Result | Connect (std::chrono::milliseconds timeout=std::chrono::minutes(1)) override |
virtual IYISocket::Result | Disconnect () override |
virtual bool | IsConnected () const override |
virtual IYISocket::Result | Send (const char *pBuffer, size_t length, std::chrono::milliseconds timeout=std::chrono::minutes(1)) override |
virtual IYISocket::Result | Send (const char *pBuffer, size_t length, size_t &sent, std::chrono::milliseconds timeout=std::chrono::minutes(1)) override |
virtual IYISocket::Result | Receive (char *pBuffer, size_t length, size_t &received, std::chrono::milliseconds timeout=std::chrono::minutes(1)) override |
virtual uint64_t | GetTotalBytesSent () const override |
virtual uint64_t | GetTotalBytesReceived () const override |
![]() | |
virtual | ~IYISocket () |
Static Public Member Functions | |
static std::unique_ptr< CYITCPSecureSocket > | Create (const CYIString &host, uint16_t port) |
Protected Member Functions | |
CYITCPSecureSocket (const CYIString &host, uint16_t port) | |
Additional Inherited Members | |
![]() | |
enum | Result { Result::Success = 0, Result::Error, Result::NotConnected, Result::Close, Result::TimedOut } |
Possible return values from socket operations. More... | |
|
virtual |
|
protected |
|
overridevirtual |
Initiates a connection based on the socket's address and configuration. Returns Result to indicate socket operation result. timeout is the length of time in milliseconds that the socket will wait for a connection before aborting the Connect() operation. The default timeout is set to 1 minute.
Implements IYISocket.
|
static |
Factory method to create a secure socket based on the host and port passed in. Returns the created CYITCPSecureSocket.
|
overridevirtual |
Closes the connection on the socket. Returns Result to indicate socket operation result.
Implements IYISocket.
|
overridevirtual |
Returns the total number of bytes received during the lifetime of the socket.
Implements IYISocket.
|
overridevirtual |
Returns the total number of bytes sent during the lifetime of the socket.
Implements IYISocket.
|
overridevirtual |
Returns true if the socket is connected.
Implements IYISocket.
|
overridevirtual |
Receives a character buffer, pBuffer from a socket, passing in the length,length, of the buffer. received is an output parameter representing the number of bytes successfully received. Returns Result to indicate socket operation result. timeout is the length of time in milliseconds that the socket will wait for until reporting an error. The default timeout is set to 1 minute.
Implements IYISocket.
|
overridevirtual |
Sends the entire contents of the specified buffer to the socket. timeout is the length of time in milliseconds that the socket will wait for until reporting an error. The default timeout is set to 1 minute.
Returns Result to indicate socket operation result.
Implements IYISocket.
|
overridevirtual |
Tries to send the specified buffer to the socket. sent is an output parameter representing the number of bytes that were successfully sent (the operation may be partial and so the remainder of the buffer needs to be sent separately in such a case). timeout is the length of time in milliseconds that the socket will wait for until reporting an error. The default timeout is set to 1 minute.
Implements IYISocket.