NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
Diff: Socket.cpp
- Revision:
- 98:0f614f1d0398
- Parent:
- 93:65a9f84862f0
- Child:
- 99:f51358e506c1
--- a/Socket.cpp Tue Apr 19 18:24:46 2016 -0500 +++ b/Socket.cpp Tue Apr 19 18:24:57 2016 -0500 @@ -58,6 +58,27 @@ return _iface->socket_close(socket); } +int Socket::bind(uint16_t port) +{ + SocketAddress addr(0, port); + return bind(addr); +} + +int Socket::bind(const char *address, uint16_t port) +{ + SocketAddress addr(address, port); + return bind(addr); +} + +int Socket::bind(const SocketAddress &address) +{ + if (!_socket) { + return NSAPI_ERROR_NO_SOCKET; + } + + return _iface->socket_bind(_socket, address); +} + void Socket::set_blocking(bool blocking) { _blocking = blocking;