Encapsulates information about a service.
TServiceEntry()
Initializes all data members of servent to 0.
The TServiceManager class (and its friend class TServiceWindow) encapsulate the Winsock database func...
virtual ~TServiceManager()
If there are any outstanding requests, this cancels them.
HANDLE LastServiceRequest
Handle of last service request.
bool LastServiceRequestCompleted
Is the last request done?
int GetServiceName(uint16 nPort, char *szName, const char *szProtocol=0)
This function is blocking.
int GetServiceAsync(HANDLE &hService, uint16 nPort, const char *szProtocol=0)
This call is non-blocking.
int GetServicePort(char *szName, uint16 &nPort, const char *szProtocol=0)
This function is blocking.
TServiceWindow Window
Private window for catching notification.
void ServiceCompleted(int nError)
This function is called whenever an internal window callback is used for an asynchronous call.
int GetService(TServiceEntry *&sEntry, uint16 nPort, const char *szProtocol=0)
Implements the blocking getservbyport().
TServiceManager()
This function creates the hidden window and initializes data members.
int CancelServiceRequest(HANDLE hService=0)
This function cancels a pending service that equals the hService.
char ServiceBuffer[MAXGETHOSTSTRUCT]
Used for calls to WSAAsync...()
int OutstandingServiceRequests
Count of total requests done by myself that haven't completed yet.
int LastError
Last error code.
TServiceWindow is a private class created by the TServiceManager to catch notifications.
TServiceManager * ServiceManagerParent
Object to pass notifications.
TResult DoNotification(TParam1, TParam2)
This function merely calls the parent notification function.
static HANDLE WSAAsyncGetServByPort(HWND hWnd, uint msg, int port, LPCSTR proto, char *buf, int bufLen)
static struct servent * getservbyname(LPCSTR name, LPCSTR proto)
static int WSAGetLastError(void)
static int WSACancelAsyncRequest(HANDLE hTaskHandle)
static struct servent * getservbyport(int port, LPCSTR proto)
static HANDLE WSAAsyncGetServByName(HWND hWnd, uint msg, LPCSTR name, LPCSTR proto, char *buf, int bufLen)
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
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.
General definitions used by all ObjectWindows programs.
#define EV_MESSAGE(message, method)
Response table entry for raw message handling Uses a dispatcher that just forwards WPARAM and LPARAM.
Main header of the Winsock OWL subsystem.
#define MSG_SERVICE_NOTIFY