a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module
Dependents: Seeed_GPRS_Library_HelloWorld Seeed_GPRS_Xively_HelloWorld Seeed_ARCH_GPRS_V2_Xively_HelloWorld Seeed_ARCH_GPRS_V2_ThingSpeak_HelloWorld ... more
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. | |
int | close () |
Close the socket file descriptor. | |
Friends | |
class | TCPSocketServer |
Detailed Description
TCP socket connection.
Definition at line 30 of file TCPSocketConnection.h.
Constructor & Destructor Documentation
TCP socket connection.
Definition at line 25 of file TCPSocketConnection.cpp.
Member Function Documentation
int close | ( | ) | [inherited] |
Close the socket file descriptor.
Definition at line 37 of file Socket.cpp.
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 29 of file TCPSocketConnection.cpp.
bool is_connected | ( | void | ) |
Check if the socket is connected.
- Returns:
- true if connected, false otherwise.
Definition at line 44 of file TCPSocketConnection.cpp.
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.cpp.
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 87 of file TCPSocketConnection.cpp.
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 49 of file TCPSocketConnection.cpp.
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 61 of file TCPSocketConnection.cpp.
Generated on Thu Jul 14 2022 07:16:02 by 1.7.2