|
Zappy GUI
C++ graphic client: renderer, camera, network
|
Simple TCP socket wrapper. More...
#include <TcpSocket.hpp>
Collaboration diagram for TcpSocket:Public Member Functions | |
| ~TcpSocket () | |
| Wraps close(). | |
| void | connect (const std::string &host, int port) |
| Connects to a remote host. | |
| void | send (const std::string &data) |
| Sends data through the socket. | |
| std::optional< std::string > | recvLine () |
| Receives a line of text from the socket. | |
| bool | poll (int timeout_ms) |
| Polls the socket for incoming data. | |
Private Attributes | |
| int | _fd = -1 |
| std::string | _recvBuffer |
Simple TCP socket wrapper.
Definition at line 22 of file TcpSocket.hpp.
| TcpSocket::~TcpSocket | ( | ) |
| void TcpSocket::connect | ( | const std::string & | host, |
| int | port | ||
| ) |
Connects to a remote host.
| host | The hostname or IP address to connect to. |
| port | The port to connect to. |
| TcpException | on failure. |
Definition at line 16 of file TcpSocket.cpp.
References _fd, and connect().
Referenced by App::_connectWithRetry(), and connect().
Here is the call graph for this function:
Here is the caller graph for this function:| bool TcpSocket::poll | ( | int | timeout_ms | ) |
Polls the socket for incoming data.
| timeout_ms | The timeout in milliseconds. |
| TcpException | on failure. |
Definition at line 139 of file TcpSocket.cpp.
References _fd, and _recvBuffer.
Referenced by App::pollAndEnqueue().
Here is the caller graph for this function:| std::optional< std::string > TcpSocket::recvLine | ( | ) |
Receives a line of text from the socket.
| TcpException | on failure. |
Definition at line 95 of file TcpSocket.cpp.
References _fd, and _recvBuffer.
Referenced by App::pollAndEnqueue().
Here is the caller graph for this function:| void TcpSocket::send | ( | const std::string & | data | ) |
Sends data through the socket.
| data | The data to send. |
| TcpException | on failure. |
Definition at line 83 of file TcpSocket.cpp.
Referenced by App::_connectWithRetry(), App::_trySendStu(), and send().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 60 of file TcpSocket.hpp.
Referenced by connect(), poll(), recvLine(), send(), and ~TcpSocket().
|
private |
Definition at line 61 of file TcpSocket.hpp.
Referenced by poll(), and recvLine().