Rabbit Remote Control 0.0.36
Loading...
Searching...
No Matches
Event.h
1#ifndef __EVENT_H_KL_2025_05_23__
2#define __EVENT_H_KL_2025_05_23__
3
4#pragma once
5
6#include <QObject>
7
8#if defined(Q_OS_WIN)
9 #include <WinSock2.h>
10#else
11 #define SOCKET int
12#endif
13
14#include "client_export.h"
15
16namespace Channel {
17
18class CLIENT_EXPORT CEvent : public QObject
19{
20 Q_OBJECT
21public:
22 explicit CEvent(QObject *parent = nullptr);
23 virtual ~CEvent();
24
25 int Reset();
26 int WakeUp();
27
28 qintptr GetFd();
29
30 static int SetSocketNonBlocking(SOCKET fd);
31 static int SetSocketBlocking(SOCKET fd, bool block);
32 static bool EnableNagles(SOCKET fd, bool enable);
33
34 static QString GetAddress(void* address);
35
36private:
37 qintptr fd[2];
38
39 int Init();
40 int Clear();
41 int CreateSocketPair(qintptr fd[]);
42};
43
44} //namespace Channel
45
46#endif // __EVENT_H_KL_2025_05_23__