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.

Branch:
api-changes
Revision:
43:09ea32f2eb54
Parent:
42:49893d13c432
Child:
48:b3bbe28a7963
--- a/Socket.h	Tue Feb 23 05:07:02 2016 -0600
+++ b/Socket.h	Wed Feb 24 22:04:19 2016 -0600
@@ -53,16 +53,6 @@
      */
     uint16_t getPort() const;
 
-    /** Set a timeout on network operations
-     *  @param timeout Maximum time in milliseconds for socket operations
-     */
-    void setTimeout(uint32_t timeout);
-
-    /** Get the current timeout on network operations
-     *  @return Maximum time in milliseconds for socket operations
-     */
-    uint32_t getTimeout() const;
-
     /** Returns status of socket
      *  @return true if connected
      */
@@ -70,11 +60,11 @@
 
 
     /** Open a connection to the underlying address
-     *  @param url Optional URL or IP address to connect to
+     *  @param address Optional URL or IP address to connect to
      *  @param port Optional port to connect to
      *  @return 0 on success
      */
-    int32_t open(const char *url = 0, uint16_t port = 0);
+    int32_t open(const char *address = 0, uint16_t port = 0);
 
     /** Close an open connection
      *  @return 0 on success
@@ -107,7 +97,6 @@
 
     char _ip_address[NS_IP_SIZE];
     uint16_t _port;
-    uint32_t _timeout;
 };
 
 #endif