PowerTCP Telnet for .NET CF
Login(String,String,String,String,String,Int32) Method
See Also  Send comments on this topic.
Dart.Telnet Namespace > Telnet Class > Login Method : Login(String,String,String,String,String,Int32) Method




usernamePrompt
The expected username prompt.
username
The username provided for login.
passwordPrompt
The expected password prompt.
password
The password provided for login.
commandPrompt
The command prompt used by the remote host.
timeout
The maximum number of milliseconds to wait for each expected prompt.
Logs into a telnet server using specified prompts.

Syntax

Visual Basic (Declaration) 
Public Overloads Function Login( _
   ByVal usernamePrompt As String, _
   ByVal username As String, _
   ByVal passwordPrompt As String, _
   ByVal password As String, _
   ByVal commandPrompt As String, _
   ByVal timeout As Integer _
) As Data
Visual Basic (Usage)Copy Code
Dim instance As Telnet
Dim usernamePrompt As String
Dim username As String
Dim passwordPrompt As String
Dim password As String
Dim commandPrompt As String
Dim timeout As Integer
Dim value As Data
 
value = instance.Login(usernamePrompt, username, passwordPrompt, password, commandPrompt, timeout)
C# 
public Data Login( 
   string usernamePrompt,
   string username,
   string passwordPrompt,
   string password,
   string commandPrompt,
   int timeout
)
Managed Extensions for C++ 
public: Data* Login( 
   string* usernamePrompt,
   string* username,
   string* passwordPrompt,
   string* password,
   string* commandPrompt,
   int timeout
) 
C++/CLI 
public:
Data^ Login( 
   String^ usernamePrompt,
   String^ username,
   String^ passwordPrompt,
   String^ password,
   String^ commandPrompt,
   int timeout
) 

Parameters

usernamePrompt
The expected username prompt.
username
The username provided for login.
passwordPrompt
The expected password prompt.
password
The password provided for login.
commandPrompt
The command prompt used by the remote host.
timeout
The maximum number of milliseconds to wait for each expected prompt.

Return Value

A Data object containing the data received during the login.

Remarks

For an established connection, this function will send username and password after receiving the specified login prompts. It will then read the data sent by the remote host up to the commandPrompt.

The return value contains a record of all data received during this process. A return value with no data typically indicates that the server closed the connection.

This method blocks until the login process completes successfully, the receive timeout period expires on any socket read, or the server closes the connection.

A SocketException will be thrown with an ErrorCode of 10060 (receive timeout) if the password or login prompt is not provided by the server within the timeout period specified. An exception will NOT be thrown if a timeout occurs waiting for the command prompt. Instead, the method will return and the Data.Delimiter will be null. Note that a successful login with an incorrectly specified command prompt will result in the method blocking for the timeout period before returning with the actual prompt, manifesting in a perceived delay. An incorrect password could result in a similar delay.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 4.2
© 2010 Dart Communications. All Rights Reserved.