The WDCInterface is is a drop-in replacement for an EthernetInterface class that allows the user to connect to the Internet with a Wistron NeWeb Corporation (WNC) M14A2A Series data module using the standard network Socket API's. This interface class is used in the AT&T Cellular IoT Starter Kit which is sold by Avnet (http://cloudconnectkits.org/product/att-cellular-iot-starter-kit).
Dependencies: WncControllerK64F
Dependents: WNCProximityMqtt Pubnub_ATT_IoT_SK_WNC_sync BluemixDemo BluemixQS ... more
WncTCPSocketConnection Class Reference
TCP socket connection. More...
#include <WncTCPSocketConnection.h>
Inherits WncSocket, and WncEndpoint.
Public Member Functions | |
| WncTCPSocketConnection(void) 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. | |
| void | set_blocking (bool blocking, unsigned int timeout=1500) |
| Set blocking or non-blocking mode of the socket and a timeout. | |
| int | close (void) |
| Close the socket. | |
| void | reset_address (void) |
| Reset the address of the endpoint by clearning the internal endpoint IP address. | |
| int | set_address (const char *host, const int port) |
| Set the address of the endpoint. | |
| char * | get_address (void) |
| Get the IP address of the endpoint. | |
| int | get_port (void) |
| Get the port of the endpoint. | |
Detailed Description
TCP socket connection.
Definition at line 34 of file WncTCPSocketConnection.h.
Member Function Documentation
| int close | ( | void | ) |
Close the socket.
- Parameters:
-
none
- Returns:
- 0 if closed successfully, -1 on failure
Definition at line 113 of file WncTCPSocketConnection.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 45 of file WncTCPSocketConnection.cpp.
| char * get_address | ( | void | ) | [inherited] |
Get the IP address of the endpoint.
- Returns:
- The IP address of the endpoint.
Definition at line 71 of file WncEndpoint.cpp.
| int get_port | ( | void | ) | [inherited] |
Get the port of the endpoint.
- Returns:
- The port of the endpoint
Definition at line 75 of file WncEndpoint.cpp.
| bool is_connected | ( | void | ) |
Check if the socket is connected.
- Returns:
- true if connected, false otherwise.
Definition at line 51 of file WncTCPSocketConnection.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 71 of file WncTCPSocketConnection.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 109 of file WncTCPSocketConnection.cpp.
| void reset_address | ( | void | ) | [inherited] |
Reset the address of the endpoint by clearning the internal endpoint IP address.
- Parameters:
-
none
- Returns:
- none.
Definition at line 35 of file WncEndpoint.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 55 of file WncTCPSocketConnection.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 105 of file WncTCPSocketConnection.cpp.
| int set_address | ( | const char * | host, |
| const int | port | ||
| ) | [inherited] |
Set the address of the endpoint.
- Parameters:
-
host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS). port The endpoint port
- Returns:
- 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
Definition at line 45 of file WncEndpoint.cpp.
| void set_blocking | ( | bool | blocking, |
| unsigned int | timeout = 1500 |
||
| ) |
Set blocking or non-blocking mode of the socket and a timeout.
- Parameters:
-
blocking true for blocking mode, false for non-blocking mode.
- Returns:
- none
Reimplemented from WncSocket.
Definition at line 33 of file WncTCPSocketConnection.cpp.
Generated on Tue Jul 12 2022 20:19:35 by
1.7.2