modified by ohneta

Dependents:   HelloESP8266Interface_mine

Fork of NetworkSocketAPI by NetworkSocketAPI

Revision:
13:f84e69b3fdd3
Parent:
12:ab3679eb4d9d
Child:
14:9e1bd182ef07
--- a/SocketInterface.h	Thu Jul 16 05:19:17 2015 +0000
+++ b/SocketInterface.h	Fri Jul 17 23:14:01 2015 +0000
@@ -58,20 +58,20 @@
         @param addr The endpoint address
         @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
      */
-    virtual int32_t setAddress(const char* addr) const = 0;
+    virtual void setAddress(const char* addr) = 0;
 
     /** Set the port of this endpoint
         @param port The endpoint port
         @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
      */
-    virtual int32_t setPort(uint16_t port) const = 0;
+    virtual void setPort(uint16_t port) = 0;
 
     /** Set the address and port of this endpoint
         @param addr The endpoint address (supplied as an ip address).
         @param port The endpoint port
         @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
      */
-    virtual int32_t setAddressPort(const char* addr, uint16_t port) const = 0;
+    virtual void setAddressPort(const char* addr, uint16_t port) = 0;
 
     /** Get the IP address of this endpoint
         @return The IP address of this endpoint.
@@ -82,7 +82,9 @@
         @return The port of this socket
      */
     virtual uint16_t getPort(void) const = 0;
-
+protected:
+    char* _addr;
+    uint16_t _port;
 };
 
 /** SocketInterface class.
@@ -113,7 +115,7 @@
         @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 open() const = 0;
+    virtual int32_t open() = 0;
     
     /** In client or server mode send data
         @param data A buffer of data to send
@@ -121,7 +123,7 @@
         @param timeout_ms The longest amount of time this send can take
         @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) const = 0;
+    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
@@ -129,13 +131,15 @@
         @param timeout_ms The longest time to wait for the data
         @return The amount of data received
      */
-    virtual uint32_t recv(const void *data, uint32_t amount, uint32_t timeout_ms = 15000) const = 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 
         @return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
      */
     virtual int32_t close() const = 0;
+protected:
+    socket_protocol_t _type;
 
 };