generic windows udp bridge working as well
This commit is contained in:
@ -8,32 +8,16 @@
|
||||
#endif
|
||||
|
||||
TcpIpBase::TcpIpBase() {
|
||||
closeSocket(serverSocket);
|
||||
|
||||
}
|
||||
|
||||
TcpIpBase::~TcpIpBase() {
|
||||
closeSocket(serverSocket);
|
||||
#ifdef _WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int TcpIpBase::closeSocket(socket_t socket) {
|
||||
#ifdef _WIN32
|
||||
return closesocket(socket);
|
||||
#elif defined(__unix__)
|
||||
return close(socket);
|
||||
#endif
|
||||
}
|
||||
|
||||
int TcpIpBase::getLastSocketError() {
|
||||
#ifdef _WIN32
|
||||
return WSAGetLastError();
|
||||
#elif defined(__unix__)
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
|
||||
ReturnValue_t TcpIpBase::initialize() {
|
||||
#ifdef _WIN32
|
||||
/* Initiates Winsock DLL. */
|
||||
@ -51,3 +35,20 @@ ReturnValue_t TcpIpBase::initialize() {
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
int TcpIpBase::closeSocket(socket_t socket) {
|
||||
#ifdef _WIN32
|
||||
return closesocket(socket);
|
||||
#elif defined(__unix__)
|
||||
return close(socket);
|
||||
#endif
|
||||
}
|
||||
|
||||
int TcpIpBase::getLastSocketError() {
|
||||
#ifdef _WIN32
|
||||
return WSAGetLastError();
|
||||
#elif defined(__unix__)
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user