Cafu Engine
WinSockT Class Reference

This class simplifies the usage of the WinSock API. More...

#include "Network.hpp"

Classes

struct  BadVersion
 Bad version error. More...
 
struct  InitFailure
 WinSock initialization error. More...
 

Public Member Functions

 WinSockT (unsigned short RequestedVersion=0x0002)
 Constructor: Initializes WinSock. More...
 
 ~WinSockT ()
 Shuts down WinSock properly by calling WSACleanup(). More...
 
SOCKET GetTCPServerSocket (unsigned short PortNr) const
 Creates a non-blocking TCP/IP listener socket, that is bound to port PortNr. More...
 
SOCKET GetTCPClientSocket (const char *ServerAddress, unsigned short ServerPortNr) const
 Creates a non-blocking TCP/IP socket that is connected to ServerPortNr at ServerAddr. More...
 
SOCKET GetUDPSocket (unsigned short PortNr) const
 Creates a non-blocking UDP socket that is bound to port PortNr. More...
 

Detailed Description

This class simplifies the usage of the WinSock API.

Constructor & Destructor Documentation

WinSockT::WinSockT ( unsigned short  RequestedVersion = 0x0002)

Constructor: Initializes WinSock.

Parameters
RequestedVersionWinSock version to request.
Exceptions
InitFailureon failure
BadVersionif the requested version is not supported.
WinSockT::~WinSockT ( )

Shuts down WinSock properly by calling WSACleanup().

Member Function Documentation

SOCKET WinSockT::GetTCPClientSocket ( const char *  ServerAddress,
unsigned short  ServerPortNr 
) const

Creates a non-blocking TCP/IP socket that is connected to ServerPortNr at ServerAddr.

Parameters
ServerAddressThe server address to connect to.
ServerPortNrThe port number number to connect to.
SOCKET WinSockT::GetTCPServerSocket ( unsigned short  PortNr) const

Creates a non-blocking TCP/IP listener socket, that is bound to port PortNr.

Parameters
PortNrThe port number number to bind this listener socket to.
SOCKET WinSockT::GetUDPSocket ( unsigned short  PortNr) const

Creates a non-blocking UDP socket that is bound to port PortNr.

Parameters
PortNrThe port number this UDP socket is bound to.

The documentation for this class was generated from the following files: