/********************************************************************* * * overview: * UDP communication * * * copyright: Shanghai Baosight Software Co., Ltd. * * Version history * 1.0 2022-05-21 zoufuzhou create * *********************************************************************/ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; class UdpConnection : public IceUtil::Thread { private: int sHost; struct sockaddr_in myaddr;//服务器地址 int retVal;//调用Socket函数的返回 char buffer[BUFF_SIZE]; string conip; int conport; int iMode; int on; // int subsize;//订阅点的个数 int m_eventNo; bool m_completed; int m_totallength;; int m_isrun; TCACHE m_tcache; private: bool Connect(); bool UdpMsg(); void AssembleMsg(const char* buffer,int length); public: virtual void run(); UdpConnection(const string& ip,int port,int eventNo = 0); // void subscribe(const string& tags); virtual ~UdpConnection(void); };