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.
Diff: SocketAddress.h
- Revision:
- 87:94e2cf3a06be
- Parent:
- 80:9c6673c93082
- Child:
- 89:b1d417383c0d
--- a/SocketAddress.h Tue Apr 05 23:39:54 2016 +0000 +++ b/SocketAddress.h Tue Apr 05 23:47:04 2016 +0000 @@ -19,6 +19,14 @@ #include <stdint.h> +/** Maximum size of IP address +*/ +#define NSAPI_IP_SIZE 16 + +/** Maximum size of MAC address +*/ +#define NSAPI_MAC_SIZE 18 + // Predeclared classes class NetworkInterface; @@ -27,10 +35,6 @@ */ class SocketAddress { public: - /** Maximum size of IP address - */ - static const int IP_SIZE = 16; - /** SocketAddress construction using DNS resolution /param iface NetworkInterface to use for DNS resolution /param addr Null-terminated hostname that will be resolved @@ -72,7 +76,7 @@ uint16_t get_port(void) const; private: - char _ip_address[IP_SIZE]; + char _ip_address[NSAPI_IP_SIZE]; uint16_t _port; };