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.


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.


RevisionDateWhoCommit message
125:ea3a618e0818 2016-05-25 dkato Fix the path of DnsQuery.lib default tip
124:d2656a514a27 2016-05-16 Christopher Haster Fix SocketAddress constructor to support ipv6
123:556a038fdf63 2016-05-10 Christopher Haster Add NSAPI_ERROR_PARAMETER
122:b316a6631ef8 2016-05-10 Christopher Haster Fix bug with SocketAddress init
121:eaea4c1291c2 2016-05-09 Christopher Haster Merged 4f8b720d512a
120:6eb542426f15 2016-05-09 Christopher Haster Fix port issue in SocketAddress constructor
119:4f8b720d512a 2016-04-21 Christopher Haster Fix issue with not passing interface through accept call
118:96627c4b83d5 2016-04-20 Christopher Haster Fix for timeout issue with WFI
117:ff83eb6a1ab9 2016-04-20 Christopher Haster Fix bug in timeout logic
116:bc043343d753 2016-04-20 Christopher Haster Added WFI to save power in temporary polling implementation
115:950b19eb0f02 2016-04-20 Christopher Haster Consolidate set_timeout/set_blocking behaviour to avoid ambiguity when both are used and match python behaviour
114:964eba6394bc 2016-04-20 Christopher Haster Move get_mac_address into Interface interface
113:80ba92c5e5ca 2016-04-20 Christopher Haster Separate Stack/Interface concept into two distinct classes
112:e0cbb3e43c20 2016-04-20 Christopher Haster Add standardized stack options
111:df01ca3e89b3 2016-04-20 Christopher Haster Add workaround for bug in newlib scanf
110:58aea4713a41 2016-04-19 Christopher Haster Updated DnsQuery
109:5d8bd5752386 2016-04-19 Christopher Haster Merged changes to NSAPI
108:2e5eccf30a84 2016-04-20 geky Fixe race condition in socket close
107:8b26e40c6e34 2016-04-19 Christopher Haster Removed trailing files
106:c388f74d5111 2016-04-19 Christopher Haster Updated DnsQuery
105:2fd212f8da61 2016-04-19 Christopher Haster Rename Interface -> Stack
104:d28d8b508e7c 2016-04-19 Christopher Haster Revised documentation for Interface classes
103:37decbcb1108 2016-04-19 Christopher Haster Revisited documentation for Socket API
102:9002476b9136 2016-04-19 Christopher Haster Removed is_connected function
101:9caa935c3baa 2016-04-19 Christopher Haster Revisited documentation for NetworkInterface specific methods
100:90d8f662de83 2016-04-19 Christopher Haster Added support for shortened form ipv6 addresses
99:f51358e506c1 2016-04-19 Christopher Haster Revised stack specific configurations
98:0f614f1d0398 2016-04-19 Christopher Haster Move bind to Socket
97:68232387bc75 2016-04-19 Christopher Haster Fix ipv6 addr in SocketAddress
96:656011e49d9f 2016-04-19 Christopher Haster Added better support for SocketAddress/string addresses/ports
95:b3c679f20d13 2016-04-19 Christopher Haster Move to SocketAddress in gethostbyname
94:644df37bb05b 2016-04-19 Christopher Haster Added support for storing bytes directly in SocketAddress
93:65a9f84862f0 2016-04-19 Christopher Haster Renamed NetworkInterface create/destroy methods to match Socket methods
92:dd5f19874adf 2016-04-19 Christopher Haster Move to single state-change interrupt
91:cad29ce6a01c 2016-04-19 Christopher Haster Remove shutdown parameter from close call
90:0a988e4abb72 2016-04-19 Christopher Haster Add open call as alternative to passing NetworkInterface at construction
89:b1d417383c0d 2016-04-19 Christopher Haster Adopt mbed style doxygen comments
88:6cfd38609828 2016-04-06 geky Refactored WiFi enum
87:94e2cf3a06be 2016-04-05 geky Refactored enums
86:7ca9776b9cc0 2016-04-05 geky Updated dependencies
85:ef377dec76b3 2016-04-05 Christopher Haster Updated dependency
84:d317e056fd20 2016-04-05 geky Added thunk for Socket class
83:1939323f99de 2016-04-05 geky Revised API
82:97d166c4a193 2016-04-05 Christopher Haster Added temporary polling for blocking sockets
81:1600369a29dd 2016-04-05 Christopher Haster Added proper forwarding for interrupt driven callbacks
80:9c6673c93082 2016-04-05 Christopher Haster Added support for DNS resolution
79:43a7e8c0d6cc 2016-04-05 Christopher Haster Added rough implementation of the API shim
78:0914f9b9b24b 2016-04-05 Christopher Haster Dragged over license from nsapi
77:b66a6984ed2d 2016-04-05 Christopher Haster Integrated interfaces as arguments to sockets
76:bbe51641f405 2016-04-05 Christopher Haster Added rough NetworkInterface
75:dea0cdb42241 2016-04-05 Christopher Haster Introduced SocketAddress class for efficient handling of netork addresses
74:ef2470ca328b 2016-04-05 Christopher Haster Minor improvements to API
73:968f7b32278f 2016-04-05 Christopher Haster Added callbacks on potentially blocking operations
72:6a8b52ee83ed 2016-04-05 Christopher Haster Added initial design for user-facing API
71:9c351e105812 2016-04-15 geky Added CellularInterface for Cellular devices
70:aa343098aa61 2016-04-01 geky Fixed merged api-changes
69:f034af6af872 2016-03-31 Christopher Haster Merged api changes
68:a52251517491 2016-04-01 geky Reverted api-changes
67:691869eebacd 2016-04-01 geky Created api-changes-2 branch api-changes-2
66:c84a4c76cb94 2016-04-01 geky Changed API to better match Posix sockets; ; - Send returns size on success; - Returns NS_ERROR_WOULD_BLOCK when recv would block