31 HostInfoManagerParent(hostInfoManagerParent)
41 HostInfoManagerParent->SetHostRequestCompleted(WSAGETASYNCERROR(param2));
66 while (h_addr_list[i])
88 if (index >= addressCount)
91 return *((
ulong*)h_addr_list[index]);
199 sockaddr_in* tempSockAddrIn = (sockaddr_in*)&address;
200 tempSockAddrIn->sin_addr.s_addr = tempSockAddrIn->sin_addr.s_addr;
203 (
const char *)&tempSockAddrIn->sin_addr.s_addr,
204 sizeof(
ulong), PF_INET);
275 sockaddr_in* tempSockAddrIn = (sockaddr_in*)&address;
276 tempSockAddrIn->sin_addr.s_addr = tempSockAddrIn->sin_addr.s_addr;
281 (
char *)&tempSockAddrIn->sin_addr.s_addr,
329 sockaddr_in* tempSockAddrIn = (sockaddr_in*)&address;
330 tempSockAddrIn->sin_addr.s_addr = tempSockAddrIn->sin_addr.s_addr;
337 (
char *)&tempSockAddrIn->sin_addr.s_addr,
338 sizeof(
ulong), PF_INET, bufferToUse,
361 uint message,
char * buffer)
386 tempInAddr.s_addr = *((
ulong*)entry->h_addr);
392 strcpy(address, tempAddress);
416 int error = WSAGETASYNCERROR(result);
THostEntry encapsulates the attributes of a host (hostent).
int GetAddressCount()
Returns the number of pointers to addresses in the hostent (parent class of THostEntry).
ulong GetNthINetAddress(int nIndex=0)
An internet addressing -specific function.
THostEntry()
Constructor of THostEntry object. Initializes members describing host to 0.
The THostInfoManager class (and its friend class THostInfoWindow) encapsulate the Winsock database fu...
THostInfoManager()
This function initializes the hidden window.
int CancelHostRequest(HANDLE hTheHostRequest=0)
The caller can use this call to cancel the last pending request.
static int HostEntryToAddress(THostEntry *hEntry, char *szAddress)
Given a THostEntry*, this function converts it to a dotted-decimal szAddress.
int GetHostAddress(char *szHostAddress, const char *szHostName)
This function effectively converts szHostName to szHostAddress.
HANDLE HostRequest
Handle of host to get info about.
int LastError
Last error code.
bool HostRequestCompleted
Flag if host completed last request.
char HostInfoBuffer[MAXGETHOSTSTRUCT]
Used for calls to WSAAsync...().
int GetHostInfo(THostEntry *&hEntry, const TSocketAddress &sAddress)
The caller of this function supplies a pointer to be assigned by this function.
int GetHostName(char *name, int nameLength=N_MAX_HOST_NAME)
This function returns the name of the computer on which this program is running.
int GetHostInfoAsync(HANDLE &hTheHostRequest, TSocketAddress &sAddress)
The TheHostRequest parameter is returned to the caller with the asynchrous request handle.
THostInfoWindow HostWindow
Hidden window to catch notifications.
virtual ~THostInfoManager()
With this destructor, you need to clear any pending requests before the deletion.
void SetHostRequestCompleted(int error)
This function is called whenever an asynchronous request is completed.
A private class created by THostInfoManager to catch WinSock messages.
THostInfoWindow(THostInfoManager *hostInfoManagerParent)
The HostInfoWindow requires a HostInfoManager, so it can relay messages to it.
TResult DoNotification(TParam1, TParam2)
This is a relay function.
The TINetSocketAddress class encapsulates a Winsock Internet address.
void SetNetworkAddress(ulong address)
This function sets the network address.
The TSocketAddress class stores a Winsock socket address.
static struct hostent * gethostbyname(LPCSTR name)
static HANDLE WSAAsyncGetHostByAddr(HWND hWnd, uint msg, LPCSTR addr, int len, int type, char *buf, int bufLen)
static int gethostname(char *name, int nameLen)
static HANDLE WSAAsyncGetHostByName(HWND hWnd, uint msg, LPCSTR name, char *buf, int bufLen)
static struct hostent * gethostbyaddr(LPCSTR addr, int len, int type)
static int WSAGetLastError(void)
static int WSACancelAsyncRequest(HANDLE hTaskHandle)
static char * inet_ntoa(struct in_addr in)
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Object Windows Library (OWLNext Core).
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
LRESULT TResult
Result type.
EV_MESSAGE(BM_SETSTYLE, BMSetStyle)
General definitions used by all ObjectWindows programs.
#define STATIC_CAST(targetType, object)
Main header of the Winsock OWL subsystem.
#define MSG_HOST_INFO_NOTIFY