-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathws-util.h
More file actions
34 lines (23 loc) · 913 Bytes
/
ws-util.h
File metadata and controls
34 lines (23 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//////////////////////////////////////////////////////////////////////////
// ws-util.h - Declarations for the Winsock utility functions module.
//////////////////////////////////////////////////////////////////////////
#pragma once
#define FD_SETSIZE 2
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <winsock2.h>
#include <string>
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define LINE_NO TOSTRING(__LINE__)
#define __FUNC__ __FUNCTION__ "() [" LINE_NO "] --> "
//// Constants ///////////////////////////////////////////////////////////
enum {
kBufferSize = 8192,
kExtraBytes = 256,
kSafeBufferSize = kBufferSize + kExtraBytes,
};
//// Functions ///////////////////////////////////////////////////////////
std::string WSAGetLastErrorMessage
(const char* pcMessagePrefix, int nErrorID = 0);
/// ¹Ø±ÕÒ»¸öÁ¬½Ó
bool ShutdownConnection(SOCKET sd, bool gracefully = false);