ap
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Diff: Socket.h
- Revision:
- 58:1caa187fa5af
- Parent:
- 57:3c873fab4207
- Child:
- 63:531f4c27f360
--- a/Socket.h Thu Feb 25 19:00:39 2016 -0600 +++ b/Socket.h Thu Feb 25 21:20:25 2016 -0600 @@ -28,45 +28,13 @@ public: ~Socket(); - /** Set the URL of the socket - * Performs DNS lookup if necessary - * @param url URL to connect to + + /** Open a connection to the underlying address + * @param address URL or IP address to connect to + * @param port Port to connect to * @return 0 on success */ - int32_t setURL(const char *url); - - /** Set the IP address of the socket - * @param ip IP address to connect to, copied internally - */ - void setIPAddress(const char *ip); - - /** Set the port of the socket - * @param port Port to connect to - */ - void setPort(uint16_t port); - - /** Gets the IP address - * @return IP address to connect to - */ - const char *getIPAddress() const; - - /** Gets the port - * @return Port to connect to - */ - uint16_t getPort() const; - - /** Returns status of socket - * @return true if connected - */ - bool isConnected(); - - - /** Open a connection to the underlying address - * @param address Optional URL or IP address to connect to - * @param port Optional port to connect to - * @return 0 on success - */ - int32_t open(const char *address = 0, uint16_t port = 0); + int32_t open(const char *address, uint16_t port); /** Close an open connection * @return 0 on success @@ -89,6 +57,22 @@ int32_t recv(void *data, uint32_t size, bool blocking = true); + /** Gets the IP address + * @return IP address to connect to + */ + const char *getIPAddress() const; + + /** Gets the port + * @return Port to connect to + */ + uint16_t getPort() const; + + /** Returns status of socket + * @return true if connected + */ + bool isConnected(); + + protected: Socket(NetworkInterface *iface, ns_protocol_t proto);