Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Diff: SocketInterface.h
- Revision:
- 16:658d4943c753
- Parent:
- 14:9e1bd182ef07
- Child:
- 17:412be55c4ee8
--- a/SocketInterface.h Wed Jul 22 20:55:37 2015 +0000 +++ b/SocketInterface.h Sun Jul 26 19:34:04 2015 +0000 @@ -53,7 +53,7 @@ @return The ip address of the host otherwise NULL */ virtual const char *getHostByName(const char *name) const = 0; - + /** Set the address of this endpoint @param addr The endpoint address @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). @@ -99,12 +99,12 @@ @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). */ virtual int32_t bind(uint16_t port) const = 0; - + /** In server mode, start listening to a port @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). */ virtual int32_t listen(void) const = 0; - + /** In server mode, accept an incoming connection @param endpoint The endpoint we are listening to @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). @@ -116,7 +116,7 @@ @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). */ virtual int32_t open() = 0; - + /** In client or server mode send data @param data A buffer of data to send @param amount The amount of data to send @@ -124,26 +124,26 @@ @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). */ virtual int32_t send(const void *data, uint32_t amount, uint32_t timeout_ms = 15000) = 0; - + /** In client or server mode receive data @param data a buffer to store the data in @param amount The amount of data to receive @param timeout_ms The longest time to wait for the data @return The amount of data received */ - virtual uint32_t recv(void *data, uint32_t amount, uint32_t timeout_ms = 15000) = 0; - + virtual uint32_t recv(void *data, uint32_t amount, uint32_t timeout_ms = 15000) = 0; + /** In client or server mode, close an open connection - @param endpoint The endpoint we want to connect to + @param endpoint The endpoint we want to connect to @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). */ virtual int32_t close() const = 0; - + /** Get the socket's unique handle @return socket's handle number */ virtual uint32_t getHandle() const = 0; - + protected: socket_protocol_t _type; uint32_t _handle;