ReactOS 0.4.15-dev-8102-g108db8f
socket.h File Reference
#include <stdio.h>
#include <winsock2.h>
#include <thread.h>
#include <list.h>
#include <exception>
#include <assert.h>
Include dependency graph for socket.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ESocket
 
class  ESocketWinsock
 
class  ESocketDll
 
class  ESocketOpen
 
class  ESocketClose
 
class  ESocketSend
 
class  ESocketReceive
 
class  CSocket
 
class  CServerClientSocket
 
class  CServerClientThread
 
class  CServerSocket
 

Macros

#define MAX_PENDING_CONNECTS   4
 

Typedefs

typedef CSocketLPCSocket
 
typedef CClientSocket * LPCClientSocket
 
typedef CServerClientSocketLPCServerClientSocket
 
typedef CServerClientThreadLPCServerClientThread
 
typedef CServerSocketLPCServerSocket
 

Functions

VOID InitWinsock ()
 
VOID DeinitWinsock ()
 

Macro Definition Documentation

◆ MAX_PENDING_CONNECTS

#define MAX_PENDING_CONNECTS   4

Definition at line 15 of file socket.h.

Typedef Documentation

◆ LPCClientSocket

typedef CClientSocket* LPCClientSocket

Definition at line 27 of file socket.h.

◆ LPCServerClientSocket

Definition at line 28 of file socket.h.

◆ LPCServerClientThread

Definition at line 29 of file socket.h.

◆ LPCServerSocket

Definition at line 30 of file socket.h.

◆ LPCSocket

typedef CSocket* LPCSocket

Definition at line 26 of file socket.h.

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().