Indy 9 | Content | Index | Reference

TIdGopherServer
Hierarchy, Properties, Methods, Events, See Also, Unit: IdGopherServer
Implements a Gopher server.

    TIdGopherServer = class(TIdTCPServer)

Unit
IdGopherServer
Description
The TIdGopherServer is a server implementation of the Internet Gopher protocol (RFC 1436) as described in the Internet Standards document:

- RFC 1436 - The Internet Gopher Protocol (http://www.rfc-editor.org/rfc/rfc1436.txt)

TIdGopherServer also implements partial support for the Gopher+ protocol as described in the document:

- Gopher+, Upward-Compatible Enhancements to the Internet Gopher protocol (http://boombox.micro.umn.edu/pub/gopher/gopher_protocol/Gopher+/Gopher+.txt)

Gopher is a distributed document system developed at the University of Minnesota as an attempt to make locating information resources intuitive for users through a series of structured menus leading to documents or pointers to other protocols such as Telnet and TN3270. While this has been succeeded by the World Wide Web, this is still useful for accessing legacy systems and has a low overhead due to its simplicity and structure.

TIdGopherServer.AdminEmail
TIdGopherServer
E-Mail address of the Gopher server maintainer.

    property AdminEmail: String;

Description
AdminEmail is a String property that identifies the name and/or email address for the maintainer of the Gopher server. For example:

        <admin@mygopher.com>
        Admin <admin@mygopher.com>

TIdGopherServer.TruncateLength
TIdGopherServer, See Also
Maximum length of a Gopher menu item.

    property TruncateLength: Integer;

Description
TruncateLength is an Integer property that identifies the maximum length of the display text for a Gopher menu item.

TIdGopherServer.TruncateUserFriendlyName
TIdGopherServer, See Also
Indicates that display text can be truncated.

    property TruncateUserFriendlyName: Boolean;

Description
TruncateUserFriendlyName is a Boolean property that indicates if the display text for a Gopher menu item can be truncated to the length in TruncateLength.

TIdGopherServer.Create
TIdGopherServer
Constructor for the object instance.

    constructor Create(AOwner: TComponent); override;

Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create relies on the inherited Create method, and sets DefaultPort to the standard Gopher port (IdPORT_GOPHER).

The application must set the AdminEmail property to a valid e-mail address for the administrator of the server.

TIdGopherServer.ReturnGopherItem
TIdGopherServer
Formats a Gopher menu item for display.

    function ReturnGopherItem(ItemType: Char; UserFriendlyName: String; RealResourceName: String; HostServer: String; HostPort: Integer): String;

Parameters
ItemType: Char
GOpher item type.
UserFriendlyName: String
Display name for the menu item.
RealResourceName: String
Item selector or TN3270 hint.
HostServer: String
The server hosting the Gopher menu item.
HostPort: Integer
The port number for the Gopher server.
Return Value
String - Display values for the Gopher menu item.
Description
ReturnGopherItem is a String function that returns a properly formatted Gopher menu item provided with the information from the parameters.

ItemType should be one of the following constants defined in GopherConsts.

- IdGopherItem_Document - Item is a file

- IdGopherItem_Directory - Item is a directory

- IdGopherItem_CSO - Item is a CSO phone-book server

- IdGopherItem_Error - Error

- IdGopherItem_BinHex - Item is a BinHexed Macintosh file.

- IdGopherItem_BinDOS - Item is DOS binary archive of some sort. Client must read until the TCP connection closes. Beware.

- IdGopherItem_UUE - Item is a UNIX uuencoded file.

- IdGopherItem_Search - Item is an Index-Search server.

- IdGopherItem_Telnet - Item points to a text-based telnet session.

- IdGopherItem_Binary - Item is a binary file. Client must read until the TCP connection closes. Beware.

- IdGopherItem_Redundant - Item is a redundant server

- IdGopherItem_TN3270 - Item points to a text-based tn3270 session.

- IdGopherItem_GIF - Item is a GIF format graphics file.

- IdGopherItem_Image - Item is some kind of image file. Client decides how to display

- IdGopherItem_HTML - Website

- IdGopherItem_MIME - Mime encoded file

- IdGopherItem_Information - Not a file, just information

TIdGopherServer.SendDirectoryEntry
TIdGopherServer
Send a Gopher menu item to the client.

    procedure SendDirectoryEntry(Thread: TIdPeerThread; ItemType: Char; UserFriendlyName: String; RealResourceName: String; HostServer: String; HostPort: Integer);

Parameters
Thread: TIdPeerThread
The client connection to receive the Gopher item.
ItemType: Char
The Gopher item type constant.
UserFriendlyName: String
Name to display on client menus.
RealResourceName: String
Item selector or a hint for logging into a Telnet or TN3270 service.
HostServer: String
Gopher Server hosting the item.
HostPort: Integer
Port number for the host.
Description
SendDirectoryEntry is a procedure used to send a Gopher menu item to the client connection specified in AThread.

ItemType contains a constant that identifies the item type, as defined in GopherConsts.pas, and normally contains of the following values:

- IdGopherItem_Document - Item is a file

- IdGopherItem_Directory - Item is a directory

- IdGopherItem_CSO - Item is a CSO phone-book server

- IdGopherItem_Error - Error

- IdGopherItem_BinHex - Item is a BinHexed Macintosh file.

- IdGopherItem_BinDOS - Item is DOS binary archive of some sort. Client must read until the TCP connection closes. Beware.

- IdGopherItem_UUE - Item is a UNIX uuencoded file.

- IdGopherItem_Search - Item is an Index-Search server.

- IdGopherItem_Telnet - Item points to a text-based telnet session.

- IdGopherItem_Binary - Item is a binary file. Client must read until the TCP connection closes. Beware.

- IdGopherItem_Redundant - Item is a redundant server

- IdGopherItem_TN3270 - Item points to a text-based tn3270 session.

- IdGopherItem_GIF - Item is a GIF format graphics file.

- IdGopherItem_Image - Item is some kind of image file. Client decides how to display

- IdGopherItem_HTML - Website

- IdGopherItem_MIME - 'Mime encoded file

- IdGopherItem_Information - Not a file, just information

TIdGopherServer.SetTruncateLength
TIdGopherServer, See Also
Write method for the TruncateLength property.

    procedure SetTruncateLength(length: Integer);

Description
SetTruncateLength is a procedure that provides write acess to the TruncateLength property, and updates the maximum length of a Gopher menu item line.

TIdGopherServer.SetTruncateUserFriendlyName
TIdGopherServer, See Also
Write method for the UserFriendlyName property.

    procedure SetTruncateUserFriendlyName(truncate: Boolean);

Description
SetTruncateUserFriendlyName is a procedure that provides write access to the TruncateUserFriendlyName property, and updates the value for the property.

TIdGopherServer.OnPlusRequest
TIdGopherServer
Server event handler for a Gopher+ request.

    property OnPlusRequest: TPlusRequestEvent;

Parameters
APlusData
The Gopher+ command and additional information for the request.
ARequest
The Gopher selector for the requested item.
AThread
Client connection making the request.
Description
OnPlusRequest is a TPlusRequestEvent event handler that allows the server application to respond to Gopher+ requests.

APlusData can includes the Gopher+ command in the first byte and additional information such as a requested View for an item and sometimes ASK block data sent from the client.

The command byte in APlusData can be one of the following:

- IdGopherPlusIndicator - Get the item with a Gopher+ reply code

- IdGopherPlusInformation - Get the information about the Gopher+ item

- IdGopherPlusDirectoryInformation - Get the extended directory for an Gopher+ item.

TIdGopherServer.OnRequest
TIdGopherServer
Server event handler for Gopher requests.

    property OnRequest: TRequestEvent;

Parameters
ARequest
The Gopher selector from the client.
AThread
The client connection making the request.
Description
OnRequest is a TRequestEvent event handler that allows the server application to respond to Gopher requests from the client connection in AThread.

ARequest is the selector read from the client connection.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.