Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CFinger v1.01 - The Finger Protocol

0.00/5 (No votes)
3 Mar 2000 1  
An MFC class to encapsulate the Finger protocol.
  • Download source files - 26 Kb
  • Introduction

    Welcome to CFinger, 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.


    History
    Features
    Usage
    API Reference
    Contacting the Author


    History

    V1.0 (11 October 1999)
    • First public release.

    V1.01 (17 October 1999)

    • The value returned from GetLastError() is now preserved across calls to CFingerSocket::Close().


    Features

    • 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.


    Usage

    • 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 module WinFingerDoc.cpp.
    • 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 WSAStartup() or 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.


    API Reference

    The API consists of the single public member function of the class CFinger.

    CFinger::Finger


    CFinger::Finger

    BOOL CFinger::Finger(LPCSTR pszServer, LPCSTR pszUser, CString& sReply, BOOL bVerbose = FALSE, int nPort = 79, DWORD dwTimeout = 500);

    Return Value:
    If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call ::GetLastError(). Parameters:

    • 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 "128.56.22.8".
    • 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.

    Remarks:
    Call this member function to perform the actual "Finger" operation.



    Contacting the Author

    PJ Naughter
    Email: pjn@indigo..ie
    Web: http://www.naughter.com
    17 October 1999


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here