Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Embed: (wiki syntax)

« Back to documentation index

SocketInterface Class Reference

SocketInterface Class Reference

The provides an interface for creating TCP/UDP/TLS/HTTP client sockets. More...

#include <SocketInterface.h>

Inherited by Wiconnect.

Public Member Functions

WiconnectResult closeAllSockets ()
 Close all opened sockets.
WiconnectResult registerSocketIrqHandler (Pin irqPin, const Callback &handler)
 Register a host pin as an external interrupt.
WiconnectResult unregisterSocketIrqHandler (Pin irqPin)
 Unregister a previously registered IRQ pin.
WiconnectResult connect (WiconnectSocket &socket, SocketType type, const char *host, uint16_t remortPort, uint16_t localPort, const void *args GPIO_IRQ_ARG)
 Connect to remote server.
WiconnectResult tcpConnect (WiconnectSocket &socket, const char *host, uint16_t remortPort GPIO_IRQ_ARG_NC)
 Connect to remote TCP server.
WiconnectResult tcpListen (uint16_t listeningPort, int maxClients=0 GPIO_IRQ_ARG_NC)
 Start internal TCP server and listen on specified port.
WiconnectResult tcpAccept (WiconnectSocket &socket, uint32_t timeoutMs=WICONNECT_WAIT_FOREVER)
 Wait for next client to connect to TCP server.
WiconnectResult tcpServerStop (void)
 Stop TCP server from listening on port.
WiconnectResult tlsConnect (WiconnectSocket &socket, const char *host, uint16_t remortPort, const char *certFilename=NULL GPIO_IRQ_ARG_NC)
 Connect to remote TLS server.
WiconnectResult udpConnect (WiconnectSocket &socket, const char *host, uint16_t remortPort, uint16_t localPort=SOCKET_ANY_PORT GPIO_IRQ_ARG_NC)
 Connect to remote UDP server.
WiconnectResult udpListen (WiconnectUdpServer &udpServer, uint16_t listeningPort)
 Start a UDP server listening on the given port.
WiconnectResult httpConnect (WiconnectSocket &socket, const char *url, const HttpSocketArgs *args)
 Connect to remote HTTP server.
WiconnectResult httpGet (WiconnectSocket &socket, const char *url, bool openOnly=false, const char *certFilename=NULL)
 Issue HTTP GET Request.
WiconnectResult httpPost (WiconnectSocket &socket, const char *url, const char *contextType, bool openOnly=true, const char *certFilename=NULL)
 Issue HTTP POST Request.
WiconnectResult httpHead (WiconnectSocket &socket, const char *url, const char *certFilename=NULL)
 Issue HTTP HEAD Request.
WiconnectResult httpAddHeader (WiconnectSocket &socket, const char *key, const char *value)
 Add HTTP header key/value pair to opened HTTP request.
WiconnectResult httpGetStatus (WiconnectSocket &socket, uint32_t *statusCodePtr)
 Get the HTTP status code from HTTP request.

Detailed Description

The provides an interface for creating TCP/UDP/TLS/HTTP client sockets.

A client socket connects to a remote server.

This class is an interface to the Wiconnect class. It should never be independently instantiated or the parent of another class.

Definition at line 63 of file SocketInterface.h.