andrewm@70: /* andrewm@70: * udpClient.h andrewm@70: * andrewm@70: * Created on: 19 May 2015 andrewm@70: * Author: giulio moro andrewm@70: */ andrewm@70: andrewm@70: #ifndef UDPCLIENT_H_ andrewm@70: #define UDPCLIENT_H_ andrewm@70: andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: #include andrewm@70: andrewm@70: class UdpClient{ andrewm@70: private: andrewm@70: int port; andrewm@70: int enabled; andrewm@70: int outSocket; giuliomoro@217: struct timeval stTimeOut; giuliomoro@336: fd_set stWriteFDS; andrewm@70: bool isSetPort; andrewm@70: bool isSetServer; andrewm@70: struct sockaddr_in destinationServer; andrewm@70: public: andrewm@70: UdpClient(); andrewm@70: UdpClient(int aPort, const char* aServerName); andrewm@70: ~UdpClient(); andrewm@70: void setPort(int aPort); andrewm@70: void setServer(const char* aServerName); andrewm@70: int send(void* message, int size); giuliomoro@217: int write(const char* remoteHostname, int remotePortNumber, void* sourceBuffer, int numBytesToWrite); giuliomoro@336: int waitUntilReady(bool readyForReading, int timeoutMsecs); giuliomoro@336: int setSocketBroadcast(int broadcastEnable); andrewm@70: }; andrewm@70: andrewm@70: andrewm@70: andrewm@70: #endif /* UDPCLIENT_H_ */