Base class for IP Based Networking Libraries

Dependencies:   DnsQuery

Dependents:   TempTower BSDInterfaceTests HelloBSDInterface ESP8266InterfaceTests ... more

For a complete getting started guide see the wiki...

Network Socket API

The Network Socket API provides a common interface for using sockets on network devices. The API provides a simple class-based interface that should be familiar to users experienced with other socket APIs. Additionally, the API provides a simple interface for implementing network devices, making it easy to connect hardware agnostic programs to new devices.

Network Interfaces

The NetworkInterface provides an abstract class for network devices that support sockets. Devices should provide a DeviceInterface class that inherits this interface and adds implementation specific methods for using the device. A NetworkInterface must be provided to a Socket constructor to open a socket on the interface. Currently two subclasses are defined for common devices, EthernetInterface and WiFiInterface.

Sockets

The Socket class is used for managing network sockets. Once opened, the socket provides a pipe through which data can sent and recieved to a specific endpoint. The socket class can be instantiated as either a TCPSocket or a UDPSocket which defines the protocol used for the connection.

Revision:
68:a52251517491
Parent:
66:c84a4c76cb94
Child:
70:aa343098aa61
--- a/Socket.h	Fri Apr 01 17:18:27 2016 +0000
+++ b/Socket.h	Fri Apr 01 17:49:52 2016 +0000
@@ -43,14 +43,14 @@
     /** Send data over the socket
      *  @param data Buffer of data to send
      *  @param size Size of data to send
-     *  @return Number of bytes sent or a negative value on failure
+     *  @return 0 on success
      */
     int32_t send(const void *data, uint32_t size);
 
     /** Recieve data over the socket
      *  @param data Buffer to store recieved data
      *  @param size Size of provided buffer
-     *  @param blocking If true wait for data, otherwise return NS_ERROR_WOULD_BLOCK
+     *  @param blocking If true wait for data, otherwise return 0 if no data is available
      *  @return Number of bytes recieved or a negative value on failure
      */
     int32_t recv(void *data, uint32_t size, bool blocking = true);