tcpsockets: Don't pull in platform-specific headers in headers. (#26)

This pollutes the namespace for all users of these headers.
This is particularly an issue on Windows.
This commit is contained in:
Peter Johnson
2017-08-23 01:27:19 -05:00
committed by GitHub
parent 43c103c0ac
commit 68501759fa
3 changed files with 11 additions and 19 deletions

View File

@@ -8,13 +8,23 @@
#include "tcpsockets/SocketError.h"
#ifdef _WIN32
#include <WinSock2.h>
#include <windows.h>
#else
#include <errno.h>
#include <string.h>
#endif
namespace wpi {
int SocketErrno() {
#ifdef _WIN32
return WSAGetLastError();
#else
return errno;
#endif
}
std::string SocketStrerror(int code) {
#ifdef _WIN32
LPSTR errstr = nullptr;