allsensors
Fork of C027_Support by
TCPSocketConnection Class Reference
TCP socket connection. More...
#include <TCPSocketConnection.h>
Inherits Socket.
Public Member Functions | |
TCPSocketConnection () | |
TCP socket connection. | |
int | connect (const char *host, const int port) |
Connects this TCP socket to the server. | |
bool | is_connected (void) |
Check if the socket is connected. | |
int | send (char *data, int length) |
Send data to the remote host. | |
int | send_all (char *data, int length) |
Send all the data to the remote host. | |
int | receive (char *data, int length) |
Receive data from the remote host. | |
int | receive_all (char *data, int length) |
Receive all the data from the remote host. |
Detailed Description
TCP socket connection.
Definition at line 8 of file TCPSocketConnection.h.
Constructor & Destructor Documentation
TCP socket connection.
Definition at line 15 of file TCPSocketConnection.h.
Member Function Documentation
int connect | ( | const char * | host, |
const int | port | ||
) |
Connects this TCP socket to the server.
- Parameters:
-
host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS. port The host's port to connect to.
- Returns:
- 0 on success, -1 on failure.
Definition at line 22 of file TCPSocketConnection.h.
bool is_connected | ( | void | ) |
Check if the socket is connected.
- Returns:
- true if connected, false otherwise.
Definition at line 45 of file TCPSocketConnection.h.
int receive | ( | char * | data, |
int | length | ||
) |
Receive data from the remote host.
- Parameters:
-
data The buffer in which to store the data received from the host. length The maximum length of the buffer.
- Returns:
- the number of received bytes on success (>=0) or -1 on failure
Definition at line 66 of file TCPSocketConnection.h.
int receive_all | ( | char * | data, |
int | length | ||
) |
Receive all the data from the remote host.
- Parameters:
-
data The buffer in which to store the data received from the host. length The maximum length of the buffer.
- Returns:
- the number of received bytes on success (>=0) or -1 on failure
Definition at line 73 of file TCPSocketConnection.h.
int send | ( | char * | data, |
int | length | ||
) |
Send data to the remote host.
- Parameters:
-
data The buffer to send to the host. length The length of the buffer to send.
- Returns:
- the number of written bytes on success (>=0) or -1 on failure
Definition at line 52 of file TCPSocketConnection.h.
int send_all | ( | char * | data, |
int | length | ||
) |
Send all the data to the remote host.
- Parameters:
-
data The buffer to send to the host. length The length of the buffer to send.
- Returns:
- the number of written bytes on success (>=0) or -1 on failure
Definition at line 59 of file TCPSocketConnection.h.
Generated on Wed Jul 13 2022 00:19:01 by 1.7.2