Fixing 2 issues in LifxLightBulb driver: 1) Detached thread handling (need to pass...
[iot2.git] / iotjava / iotruntime / cpp / socket / Socket.hpp
index 9da627a9ce0b5ac73afc24dd89cfe9d9c355cd58..d01c9bb226a50a9d7ab4d46a040f9c0de34f392c 100644 (file)
@@ -86,7 +86,7 @@ public:
    */
   void setLocalPort(unsigned short localPort) throw(SocketException);
 
-  /**
+  /**  ADDED BY: Rahmadi Trimananda (rtrimana@uci.edu)
    *   Set the local port to the specified port and the local address
    *   to the specified address.  If you omit the port, a random port 
    *   will be selected.
@@ -301,7 +301,7 @@ public:
 
   /**
    *   Read read up to bufferLen bytes data from this socket.  The given buffer
-   *   is where the data will be placed
+   *   is where the data will be placed (this is a non-blocking version)
    *   @param buffer buffer to receive data
    *   @param bufferLen maximum number of bytes to receive
    *   @param sourceAddress address of datagram source
@@ -312,6 +312,20 @@ public:
   int recvFrom(void *buffer, int bufferLen, string &sourceAddress, 
                unsigned short &sourcePort) throw(SocketException);
 
+  /**
+   *   Read read up to bufferLen bytes data from this socket.  The given buffer
+   *   is where the data will be placed
+   *   @param buffer buffer to receive data
+   *   @param bufferLen maximum number of bytes to receive
+   *   @param sourceAddress address of datagram source
+   *   @param sourcePort port of data source
+   *   @param timeout interval
+   *   @return number of bytes received and -1 for error
+   *   @exception SocketException thrown if unable to receive datagram
+   */
+  int recvFrom(void *buffer, int bufferLen, string &sourceAddress, 
+               unsigned short &sourcePort, int timeout) throw(SocketException);
+
   /**
    *   Set the multicast TTL
    *   @param multicastTTL multicast TTL
@@ -333,6 +347,13 @@ public:
    */
   void leaveGroup(const string &multicastGroup) throw(SocketException);
 
+  /**  ADDED BY: Rahmadi Trimananda (rtrimana@uci.edu)
+   *   Set timeout for socket
+   *   @param timeout interval (in milliseconds)
+   *   @exception SocketException thrown if unable to set timeout
+   */
+  void setTimeOut(int interval) throw(SocketException);
+
 private:
   void setBroadcast();
 };