Download source files - 26 Kb
, a very simple MFC class to encapsulate the Finger protocol.
Finger for those not familiar with all the internet protocols is the protocol used to retrieve
information about a systems users. The information returned is a simple string and can be used
for any purposes. For example the USGS (United States Geological Survey) use Finger to allow
up to date Earthquake data to be retrieved.
For detailed information about the Finger, you should read RFC 1288. You can find numerous Web
Servers which carry these documents by going to http://www.yahoo.com
and look for RFC and 1288.
The sample app provided with the code implements a very simple GUI Finger client, a definite
improvement over the console version provided by MS on NT.
V1.0 (11 October 1999)
V1.01 (17 October 1999)
- The value returned from
GetLastError() is now preserved across calls to
- Simple and clean C++ interface.
- The interface provided is synchronous which provides an easier programming model than
using asynchronous sockets.
- The code does not rely on the MFC socket classes. These classes have a number of
shortcomings, one of which causes problems when they are used in NT services.
- The code can be used in a console application without any problems (Again this is not
the case for the MFC socket classes).
- A configurable timeout for the connection can be set through the main class method.
- To use the class in your code simple include finger.cpp in your project and
#include finger.h in which ever of your modules needs to make calls to the class.
- To see the class in action, have a look at the code in
OnFileConnect() in the
- Your code will need to include MFC either statically or dynamically.
- You will need to have a functioning Winsock stack installed and correctly initialized prior
to calling the Finger method. Depending on your application, this will involve calling either
AfxSocketInit() at startup of your application.
- You will also need to have afxpriv.h and winsock.h or afxsock.h in
your precompiled header. The code will work just aswell in a GUI or console app. The code
should also work in a multithreaded application, although it has not be explicitly tested
in this scenario.
The API consists of the single public member function of the class
- BOOL CFinger::Finger(LPCSTR pszServer, LPCSTR pszUser, CString& sReply, BOOL bVerbose = FALSE, int nPort = 79, DWORD dwTimeout = 500);
If the function succeeds, the return value is TRUE. If the function fails, the return value
is FALSE. To get extended error information, call
- pszServer -- The network address of the Finger server to connect to, e.g. a machine
name such as "finger.somedomain.com", or a dotted number such as "18.104.22.168".
- pszUser -- This is the user who you wish to finger. You can set this to NULL, if you
want the server to return a list of users. It can be form "user" or "user@hostname".
- sReply -- Upon successful return, this will contain the server response / finger result.
- bVerbose -- TRUE if you want to signify a higher level of verbosity in the user
information output. The Finger server is free to ignore this flag.
- nPort -- This is the port number on which to connect. The default value is 79 which is
the default Finger port number.
- dwTimeout -- The timeout value to use in milliseconds for socket connections.
Call this member function to perform the actual "Finger" operation.
Contacting the Author
17 October 1999