Topic Path: Symbol Reference > Classes > TIdNNTP Class > TIdNNTP Methods > Connect Method
ContentsIndexHome
PreviousUpNext
TIdNNTP.Connect Method

Opens a connection to the NNTP server.

procedure Connect; override;
Parameters 
Description 
ATimeout 
Milliseconds to wait for a connection to the server. The default value is IdTimeoutDefault

Connect is an overridden procedure in TIdNNTP used to open a connection to the NNTP server using values in the Host and Port properties. Connect calls the inherited Connect method using the value in ATimeout to establish the connection, and calls GetResponse to determine the NNTP protocol response included as part of the server greeting. 

Connect sets the value in Permission based on the numeric response code in LastCmdResult using the following: values and associated Permissions: 

 

Value 
Meaning 
200 
crCanPost (Posting allowed) 
201 
crNoPost (Posting not allowed) 
400 
crTempUnavailable (Temporarily unavailable) 
502 
none (Connection refused) 

 

Connect will raise an EIdNNTPConnectionRefused exception when the numeric response code in LastCmdResult is 502, indicating that the connection request was explicitly refused by the NNTP server. 

If an Exception is encountered, Connect will call the Disconnect method and re-raise the exception. 

Connect will also attempt to set the mode for the NNTP client connection using the NNTP MODE command and the TModeType value in the Mode property. Connect stores the result of the Mode request in the ModeResult property. 

When Mode contains mtStream, ModeResult receives the value mrCanStream if the LastCmdResult contains the numeric value 203. Any other numeric response code causes ModeResult to contain mrNoStream. 

When Mode contains mtReader, ModeResult receives the value mrCanPost if the LastCmdResult contains the numeric value 200. Any other numeric response code causes ModeResult to contain mrNoPost.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.