The Micro C++ Library
|
A SSLClientSocket represents a Secure Socket Layer (TCP) client endpoint of a StreamSocket. More...
#include <micxx.hxx>
Inherits micxx::ClientSocket.
Public Member Functions | |
SSLClientSocket () | |
Create a new unbound, disconnected SSLClientSocket. | |
virtual | ~SSLClientSocket () |
Destruct a SSLClientSocket. | |
virtual void | close (ClosingMode closingMode=BiDirectional) |
virtual void | connect (const SocketAddress &socketAddress) |
virtual SSLProtocol & | getSSLProtocol () |
virtual int | recv (void *bytes, size_t size, bool blocking=true) |
virtual int | send (const void *bytes, size_t size, bool blocking=true) |
Protected Member Functions | |
SSLClientSocket (socket_t rawSocket, SocketAddress *socketAddress) | |
Create a SSLClientSocket to an already connected rawSocket socket descriptor bound to the specified socketAddress. | |
Protected Attributes | |
SSLProtocol | sslProtocol |
Friends | |
class | SSLServerSocket |
A SSLClientSocket represents a Secure Socket Layer (TCP) client endpoint of a StreamSocket.
The following example shows how to use this class with a TCP connection:
micxx::InetAddress inetAddress(addr.c_str()); micxx::SSLClientSocket sslClientSocket; // Customize the SSL protocol layer if (caStore.length()) { sslClientSocket.getSSLProtocol().setCACertificatesFile(caStore); } // Connect the SSL client endpoint to the SSL server endpoint // (TCP connect incl. SSL Handshake) sslClientSocket.connect(inetAddress); // Exchange encrypted data ... sslClientSocket.send(MESSAGE.c_str(), MESSAGE.length()); cout << sslClientSocket.readLn(); // Shutdown SSL communication and close TCP connection sslClientSocket.close();
micxx::SSLClientSocket::SSLClientSocket | ( | ) |
Create a new unbound, disconnected SSLClientSocket.
virtual micxx::SSLClientSocket::~SSLClientSocket | ( | ) | [virtual] |
Destruct a SSLClientSocket.
micxx::SSLClientSocket::SSLClientSocket | ( | socket_t | rawSocket, |
SocketAddress * | socketAddress | ||
) | [protected] |
Create a SSLClientSocket to an already connected rawSocket socket descriptor bound to the specified socketAddress.
rawSocket | the socket descriptor |
socketAddress | the socket address to be used internally. This socket takes ownership of the allocated SocketAdress and gets responsible for deleting it |
virtual void micxx::SSLClientSocket::close | ( | ClosingMode | closingMode = BiDirectional | ) | [virtual] |
Reimplemented from micxx::StreamSocket.
virtual void micxx::SSLClientSocket::connect | ( | const SocketAddress & | socketAddress | ) | [virtual] |
Reimplemented from micxx::ClientSocket.
virtual SSLProtocol& micxx::SSLClientSocket::getSSLProtocol | ( | ) | [virtual] |
virtual int micxx::SSLClientSocket::recv | ( | void * | bytes, |
size_t | size, | ||
bool | blocking = true |
||
) | [virtual] |
Reimplemented from micxx::StreamSocket.
virtual int micxx::SSLClientSocket::send | ( | const void * | bytes, |
size_t | size, | ||
bool | blocking = true |
||
) | [virtual] |
Reimplemented from micxx::StreamSocket.
friend class SSLServerSocket [friend] |
SSLProtocol micxx::SSLClientSocket::sslProtocol [protected] |