📄 gestureserver.h
字号:
// GestureServer.h: TCP/IP and UDP server//#include "HandVu.hpp" // for HVState only#include "OSCpacket.h"#include <string>#include <list>using namespace std;#ifdef WIN32#include <winsock2.h>#elsetypedef int SOCKET;#endif#define GESTUREEVENT_VERSION_STRING "1.2"typedef list<SOCKET> SocketList;class GestureServer { public: GestureServer& operator=(const GestureServer& from) ; virtual void Start() = 0; virtual void Stop() = 0; virtual void Send(const HVState& state) = 0; bool IsStarted() const {return m_started;} protected: GestureServer(); void SetNonBlocking(SOCKET sd); protected: bool m_started;};class GestureServerStream : public GestureServer { public: GestureServerStream(int port, int max_num_clients=10); GestureServerStream(const GestureServerStream& from); ~GestureServerStream(); GestureServerStream& operator=(const GestureServerStream& from); virtual void Start(); virtual void Stop(); virtual void Send(const HVState& state); protected: void InitSockets(); void CheckForNewClients(); protected: int m_port; int m_max_num_clients; SOCKET m_server_sd; SocketList m_client_sds;};class GestureServerOSC : public GestureServer { public: GestureServerOSC(string dest_ip, int dest_port=57120); GestureServerOSC(const GestureServerOSC& from); ~GestureServerOSC(); GestureServerOSC& operator=(const GestureServerOSC& from); virtual void Start(); virtual void Stop(); virtual void Send(const HVState& state); protected: string m_dest_ip; int m_dest_port; SOCKET m_server_sd; mutable OSCpacket m_packet;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -