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:
112:e0cbb3e43c20
Parent:
105:2fd212f8da61
Child:
114:964eba6394bc
--- a/NetworkStack.h	Wed Apr 20 02:56:07 2016 -0500
+++ b/NetworkStack.h	Wed Apr 20 03:19:26 2016 -0500
@@ -53,6 +53,30 @@
    NSAPI_UDP, /*!< Socket is of UDP type */
 };
 
+/*  Enum of standardized stack option levels
+ *
+ *  @enum nsapi_level_t
+ */
+enum nsapi_level_t {
+    NSAPI_STACK,  /*!< Stack option level */
+    NSAPI_SOCKET, /*!< Socket option level */
+};
+
+/*  Enum of standardized stack options
+ *
+ *  These options may not be supported on all stacks, in which
+ *  case NSAPI_ERROR_UNSUPPORTED may be returned from setsockopt.
+ *
+ *  @enum nsapi_option_t
+ */
+enum nsapi_option_t {
+    NSAPI_REUSEADDR, /*!< Allow bind to reuse local addresses */
+    NSAPI_KEEPALIVE, /*!< Enables sending of keepalive messages */
+    NSAPI_LINGER,    /*!< Keeps close from returning until queues empty */
+    NSAPI_SNDBUF,    /*!< Sets send buffer size */
+    NSAPI_RCVBUF,    /*!< Sets recv buffer size */
+};
+
 /** Maximum size of MAC address representation
  */
 #define NSAPI_MAC_SIZE 18