OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The TServiceManager class (and its friend class TServiceWindow) encapsulate the Winsock database functions getservbyname(), getservbyport(), WSAAsyncGetServByName(), and WSAAsyncGetServByPort(). These blocking (get...) and non-blocking (WSA...) functions return information about the service name, port, and protocol when given only a service name or a port.
The Winsock service database functions return a pointer to a read-only servent structure.
The TServiceManager uses a subclass of the servent class called the TServiceEntry class. Since TServiceEntry is a subclass of servant, it can be used anywhere that Winsock or Windows Socket Class requires a servent. The TServiceManager supports direct equivalents to the blocking getservbyname() and getservbyport() Winsock functions. If you wanted to find the port that the service "ftp" resides on, you could use the TServiceManager to give you this information. Calling the Winsock function:
will store the service name, the port, and the protocol in the servent structure. Calling the TServiceManager function GetService() has the same effect:
The TServiceManager also supports asynchronous (non-blocking) Winsock service lookups. These correspond to the WSAGetServByName() and WSAGetServByPort() functions. To use these classes in Winsock, you need to pass an HWND to these functions and wait until Winsock calls you back with an answer. In the Windows Socket Class, you have two choices: