ReactOS  0.4.15-dev-1384-g878186b
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 }
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
#define TS(x)
Definition: error.h:11

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 }
#define LOBYTE(W)
Definition: jmemdos.c:487
#define MAKEWORD(a, b)
Definition: typedefs.h:248
WORD wVersion
Definition: winsock.h:517
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
#define HIBYTE(W)
Definition: jmemdos.c:486
#define TS(x)
Definition: error.h:11
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
unsigned short WORD
Definition: ntddk_ex.h:93

Referenced by Run().