| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#ifdef _WIN32 |
| 7 |
#include <WinSock2.h> |
| 8 |
#include <mutex> |
| 9 |
#endif |
| 10 |
|
| 11 |
namespace Common |
| 12 |
{ |
| 13 |
class SocketContext |
| 14 |
{ |
| 15 |
public: |
| 16 |
SocketContext(); |
| 17 |
~SocketContext(); |
| 18 |
|
| 19 |
SocketContext(const SocketContext&) = delete; |
| 20 |
SocketContext(SocketContext&&) = delete; |
| 21 |
|
| 22 |
SocketContext& operator=(const SocketContext&) = delete; |
| 23 |
SocketContext& operator=(SocketContext&&) = delete; |
| 24 |
|
| 25 |
private: |
| 26 |
#ifdef _WIN32 |
| 27 |
static std::mutex s_lock; |
| 28 |
static size_t s_num_objects; |
| 29 |
static WSADATA s_data; |
| 30 |
#endif |
| 31 |
}; |
| 32 |
} |