ap
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Diff: Socket.h
- Branch:
- api-changes
- Revision:
- 41:3ec1c97e9bbf
- Parent:
- 38:157fb2ab965f
- Child:
- 42:49893d13c432
--- a/Socket.h Mon Feb 22 23:52:09 2016 -0600 +++ b/Socket.h Tue Feb 23 04:01:38 2016 -0600 @@ -53,6 +53,16 @@ */ 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 */ @@ -74,18 +84,16 @@ /** Send data over the socket * @param data Buffer of data to send * @param len Size of data to send - * @param timeout_ms Maximum amount of time to wait * @return 0 on success */ - int32_t send(const void *data, uint32_t len, uint32_t timeout_ms = 15000); + int32_t send(const void *data, uint32_t len); /** Recieve data over the socket * @param data Buffer to store recieved data * @param len Size of provided buffer - * @param timeout_ms Maximum amount of time to wait * @return Number of bytes sent or a negative value on failure */ - int32_t recv(void *data, uint32_t len, uint32_t timeout_ms = 15000); + int32_t recv(void *data, uint32_t len); protected: @@ -99,6 +107,7 @@ char _ip_address[SOCK_IP_SIZE]; uint16_t _port; + uint32_t _timeout; }; #endif