*/
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.
/**
* 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
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
*/
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();
};