OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TSocketManager Class Reference

A class that starts up WinSock and provides information about the system's WinSock. More...

#include <owl/wsksockm.h>

Public Member Functions

 TSocketManager (short versionMajor=1, short versionMinor=1, bool autoStartup=true)
 The SocketManager constructor takes a major and minor version as parameters.
 
virtual ~TSocketManager ()
 The TSocketManager destructor cleans up after itself.
 
void Init (short versionMajor=1, short versionMinor=1)
 The ITSocketManager function does some initialization for the TSocketManager.
 
int Startup ()
 The Startup() function is equivalent to the Winsock WSAStartup() function.
 
int ShutDown ()
 The ShutDown() function is the equivalent to the Winsock WSACleanup() function.
 
int IsAvailable ()
 Returns true if WinSock is available.
 
int GetMajorVersion ()
 Returns the major version of WinSock support.
 
int GetMinorVersion ()
 Returns the minor version of WinSock support.
 
charGetDescription ()
 Returns the system's description of WinSock.
 
charGetSystemStatus ()
 Returns the status of WinSock.
 
ushort GetMaxUdpDgAvailable ()
 Returns maximum number of bytes each UDP packet can be.
 
ushort GetMaxSocketsAvailable ()
 Returns maximum number of WinSock connections avaialble.
 
charGetVendorInfo ()
 Returns this WinSocket's vendor's information.
 
int GetLastError ()
 Returns the last error code.
 
void Information (TSocketInfo &socketInfo)
 Sets the information about this WinSocket.
 

Protected Attributes

int LastError
 Last error code.
 
short Available
 Flag for Winsock availability.
 
short StartupCount
 Make sure to not overflow number of connects.
 
TSocketInfo SocketInfo
 Information about this WinSocket implementation.
 
short VersionMajor
 Major verion number.
 
short VersionMinor
 Minor verion number.
 

Detailed Description

A class that starts up WinSock and provides information about the system's WinSock.

Definition at line 44 of file wsksockm.h.

Constructor & Destructor Documentation

◆ TSocketManager()

owl::TSocketManager::TSocketManager ( short versionMajor = 1,
short versionMinor = 1,
bool autoStartup = true )

The SocketManager constructor takes a major and minor version as parameters.

These version parameters are the Winsock versions that can be requested, as with WSAStartup() calls.

Definition at line 38 of file wsksockm.cpp.

References Init(), owl::TWinSock::IsAvailable(), Startup(), and StartupCount.

◆ ~TSocketManager()

owl::TSocketManager::~TSocketManager ( )
virtual

The TSocketManager destructor cleans up after itself.

Every time Startup() (same as WSAStartup()) is called, this destructor will call ShutDown (same as WSACleanup()).

Definition at line 53 of file wsksockm.cpp.

References ShutDown(), and StartupCount.

Member Function Documentation

◆ GetDescription()

char * owl::TSocketManager::GetDescription ( )
inline

Returns the system's description of WinSock.

Definition at line 113 of file wsksockm.h.

References SocketInfo.

◆ GetLastError()

int owl::TSocketManager::GetLastError ( )
inline

Returns the last error code.

Definition at line 158 of file wsksockm.h.

References LastError.

◆ GetMajorVersion()

int owl::TSocketManager::GetMajorVersion ( )
inline

Returns the major version of WinSock support.

Definition at line 95 of file wsksockm.h.

References VersionMajor.

◆ GetMaxSocketsAvailable()

ushort owl::TSocketManager::GetMaxSocketsAvailable ( )
inline

Returns maximum number of WinSock connections avaialble.

Definition at line 140 of file wsksockm.h.

References SocketInfo.

◆ GetMaxUdpDgAvailable()

ushort owl::TSocketManager::GetMaxUdpDgAvailable ( )
inline

Returns maximum number of bytes each UDP packet can be.

Definition at line 131 of file wsksockm.h.

References SocketInfo.

◆ GetMinorVersion()

int owl::TSocketManager::GetMinorVersion ( )
inline

Returns the minor version of WinSock support.

Definition at line 104 of file wsksockm.h.

References VersionMinor.

◆ GetSystemStatus()

char * owl::TSocketManager::GetSystemStatus ( )
inline

Returns the status of WinSock.

Definition at line 122 of file wsksockm.h.

References SocketInfo.

◆ GetVendorInfo()

char * owl::TSocketManager::GetVendorInfo ( )
inline

Returns this WinSocket's vendor's information.

Definition at line 149 of file wsksockm.h.

References SocketInfo.

◆ Information()

void owl::TSocketManager::Information ( TSocketInfo & socketInfo)
inline

Sets the information about this WinSocket.

Definition at line 167 of file wsksockm.h.

References SocketInfo.

◆ Init()

void owl::TSocketManager::Init ( short versionMajor = 1,
short versionMinor = 1 )

The ITSocketManager function does some initialization for the TSocketManager.

This function is separate from the constructor so it can be called at any time to re-specify the desired major and minor versions before a call to Startup(). nNewVersionMajor and nNewVersionMinor will be the values specified in the Winsock WSAStartup() call that TSocketManager::Startup() makes. The return value is TRUE or FALSE.

Definition at line 67 of file wsksockm.cpp.

References LastError, VersionMajor, and VersionMinor.

◆ IsAvailable()

int owl::TSocketManager::IsAvailable ( )
inline

Returns true if WinSock is available.

Definition at line 86 of file wsksockm.h.

References Available.

◆ ShutDown()

int owl::TSocketManager::ShutDown ( )

The ShutDown() function is the equivalent to the Winsock WSACleanup() function.

You can call this function if you want, but in its destructor, the TSocketManager will automatically call it once for every time Startup() was called. Of course, the TSocketManager cannot know about any independent WSAStartup() direct calls that are made.

Definition at line 103 of file wsksockm.cpp.

References LastError, StartupCount, WINSOCK_ERROR, WINSOCK_NOERROR, owl::TWinSockDll::WSACleanup(), and owl::TWinSockDll::WSAGetLastError().

◆ Startup()

int owl::TSocketManager::Startup ( )

The Startup() function is equivalent to the Winsock WSAStartup() function.

This function fills out the TSocketManager's SocketInfo structure (same as a WSAData structure) with the return information. GetMaxSocketsAvailable(), GetVendorInfo(), Available(), GetMajorVersion(), GetMinorVersion(), or Information() functions can then be called to get the results of the call.

Definition at line 81 of file wsksockm.cpp.

References owl::HiUint8(), LastError, owl::LoUint8(), SocketInfo, StartupCount, VersionMajor, VersionMinor, WINSOCK_ERROR, WINSOCK_NOERROR, and owl::TWinSockDll::WSAStartup().

Member Data Documentation

◆ Available

short owl::TSocketManager::Available
protected

Flag for Winsock availability.

Definition at line 68 of file wsksockm.h.

◆ LastError

int owl::TSocketManager::LastError
protected

Last error code.

Definition at line 67 of file wsksockm.h.

◆ SocketInfo

TSocketInfo owl::TSocketManager::SocketInfo
protected

Information about this WinSocket implementation.

Definition at line 70 of file wsksockm.h.

◆ StartupCount

short owl::TSocketManager::StartupCount
protected

Make sure to not overflow number of connects.

Definition at line 69 of file wsksockm.h.

◆ VersionMajor

short owl::TSocketManager::VersionMajor
protected

Major verion number.

Definition at line 71 of file wsksockm.h.

◆ VersionMinor

short owl::TSocketManager::VersionMinor
protected

Minor verion number.

Definition at line 72 of file wsksockm.h.


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