OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Using TSocketError

TSocketError is a class provided for your convenience.

It converts a WinSock error code into a string. These strings are stored in a string table resource, so you must add

#include <owl/winsock.rc>

near the top of your .RC file before you can use TSocketError. Otherwise, the error code will convert to an empty string. You convert an error code into a string by creating an instance of TSocketError:

THostInfoManager myHostInfoManager;
THostEntry* tempHostEntry;
int nError;
nError = myHostInfoManager.GetHostInfo(tempHostEntry, "j_shmoe@anywhere.com");
if (nError == SOCKET_ERROR) {
MessageBox(TSocketError(nError).GetReasonString(), "Sockets Error");
}

Note that the default size of the strings cannot be greater than 128. You can increase this value by specifying the new size as an argument to the constructor.