ReactOS 0.4.15-dev-7958-gcd0bb1a
socket.cpp File Reference
#include <socket.h>
#include <string.h>
#include <error.h>
#include <iterator.h>
Include dependency graph for socket.cpp:

Go to the source code of this file.

Functions

VOID InitWinsock ()
 
VOID DeinitWinsock ()
 

Function Documentation

◆ DeinitWinsock()

VOID DeinitWinsock ( )

Definition at line 340 of file socket.cpp.

341{
342 if (WSACleanup() != 0)
343 throw ESocketWinsock(TS("Unable to deinitialize winsock dll."));
344}
#define TS(x)
Definition: error.h:11
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60

Referenced by Run().

◆ InitWinsock()

VOID InitWinsock ( )

Definition at line 319 of file socket.cpp.

320{
321 WORD wVersionRequested;
322 WSADATA wsaData;
323
324 wVersionRequested = MAKEWORD(2, 0);
325
326 if (WSAStartup(wVersionRequested, &wsaData) != 0)
327 // Return FALSE as we couldn't find a usable WinSock DLL
328 throw ESocketWinsock(TS("Unable to initialize winsock dll."));
329
330 /* Confirm that the WinSock DLL supports 2.0 */
331
332 if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) {
333 // We couldn't find a usable winsock dll
334 WSACleanup();
335 throw ESocketDll(TS("Winsock dll version is not 2.0 or higher."));
336 }
337}
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
unsigned short WORD
Definition: ntddk_ex.h:93
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
WORD wVersion
Definition: winsock.h:517
#define MAKEWORD(a, b)
Definition: typedefs.h:248

Referenced by Run().