|
| | TcpClient (const bool &TLS=false, const char *ca="", const char *cert="", const char *key="", const char *passwd="") |
| | Constructor of TcpClient class. More...
|
| |
| bool | connect (const std::string &ip, const int &port) |
| | Initiate a TCP connection to the server. More...
|
| |
| void | resetCTX (const bool &TLS=false, const char *ca="", const char *cert="", const char *key="", const char *passwd="") |
| | Reset TLS encryption parameters for the first time or reconfigure. More...
|
| |
| bool | close () |
| | If the object has a socket connection, close and release the connection and socket, and create a new socket. More...
|
| |
| | ~TcpClient () |
| | Destructor of TcpClient, closes and releases the socket and its connection. More...
|
| |
| std::string | getServerIP () |
| | Return the IP of the connected server. More...
|
| |
| int | getServerPort () |
| | Return the port of the connected client. More...
|
| |
| bool | isConnect () |
| | Return the connection status of the object. More...
|
| |
Public Member Functions inherited from stt::network::TcpFDHandler |
| void | setFD (const int &fd, SSL *ssl, const bool &flag1=false, const bool &flag2=false, const int &sec=-1) |
| | Initialize the object with a socket. More...
|
| |
| int | getFD () |
| | Get the socket of this object. More...
|
| |
| SSL * | getSSL () |
| | Get the encrypted SSL handle of this object. More...
|
| |
| void | close (const bool &cle=true) |
| | Close the object. More...
|
| |
| void | blockSet (const int &sec=-1) |
| | Set the socket in the object to blocking mode. More...
|
| |
| void | unblockSet () |
| | Set the socket in the object to non-blocking mode. More...
|
| |
| bool | multiUseSet () |
| | Set the socket in the object to SO_REUSEADDR mode. More...
|
| |
| bool | isConnect () |
| | Determine if the object has a socket bound. More...
|
| |
| int | sendData (const std::string &data, const bool &block=true) |
| | Send string data to the connected socket. More...
|
| |
| int | sendData (const char *data, const uint64_t &length, const bool &block=true) |
| | Send a specified length of binary data to the connected socket. More...
|
| |
| int | recvDataByLength (std::string &data, const uint64_t &length, const int &sec=2) |
| | Blocking receive of specified length of data from a connected socket into a string. More...
|
| |
| int | recvDataByLength (char *data, const uint64_t &length, const int &sec=2) |
| | Blocking receive of specified length of data from a connected socket into a char* container. More...
|
| |
| int | recvData (std::string &data, const uint64_t &length) |
| | Receive data once from a connected socket into a string container. More...
|
| |
| int | recvData (char *data, const uint64_t &length) |
| | Receive data once from a connected socket into a char* container. More...
|
| |
TCP client operation class.
- Note
- Blocking mode by default