Telnet Object : Rlogin Method |
Visual Basic |
---|
Public Sub Rlogin( _ ByVal RemoteName As String, _ ByVal User As String, _ Optional ByVal ServerUser As String, _ Optional ByVal TermTypeSpeed As String, _ Optional ByVal CharRows As Long = 0, _ Optional ByVal CharsPerRow As Long = 0, _ Optional ByVal PixelsX As Long = 0, _ Optional ByVal PixelsY As Long = 0, _ Optional ByVal RemotePort As Long = 0, _ Optional ByVal LocalName As String, _ Optional ByVal LocalPort As Long = 0 _ ) |
The remote login protocol supports the concept of window size, where the server requests the window size of the client. Responses are automatic using the parameter values from the CharRows, CharsPerRow, PixelsX, and PixelsY parameters. See RFC 1282 for the complete remote login protocol description.
This method requires authorization for the local host running your application. This is done by adding the proper entries to the hosts.equiv or .rhosts files located on the remote host. These files enable logins to be performed from other machines and users. The hosts.equiv file is a system file containing names of remote hosts authorized to execute the remote protocol. If not authorized in this file, the remote host looks for the .rhosts file located in the user's account on the remote host. The .rhosts file contains lines of host names and login names paired together. Your local host with login name is authorized if found in this file.
When this method is called a connection is initiated with the remote host using the remote login protocol. The State property immediately changes to tcpConnecting and then changes to tcpConnected when the connection is established. The State Property can be checked in the body of the State event, polled off a timer, or checked immediately after the method is invoked when a positive Timeout is specified. The remote host prompts for the password if a password exists for the user. Rlogin is normally used as a Telnet replacement for an interactive session. Use the Rexec or Rsh method if you simply want to execute a remote command.
This method is invoked as blocking or non-blocking, depending on the value of the Timeout property.
When performing blocked method calls, the Blocked property may be checked to verify the control is not busy executing another method.
Error Codes
The Rlogin method may generate the following error codes (refer to the ErrorConstants topic for a complete list of Telnet Control error codes):
Private Sub Command1_Click() On Error GoTo OnError ' use intrinsic error handling Telnet1.Timeout = 1000 Telnet1.Rlogin "myhost", "myUsername" ' didn't go to OnError, so we connected before 30 seconds elapsed! MsgBox "Connected!" Dim Output As String Telnet1.Receive Output Text1.Text = Output Exit Sub OnError: ' Any error jumps here ' no connection within 1 second, or other error (Tcp1.State is tcpClosed) Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub
Private Sub Command1_Click() ' intrinsic error handling is of limited value for asynchronous connection&ldots; Telnet1.Timeout = 0 Telnet1.Rlogin "myhost", "myUsername" End Sub Private Sub Telnet1_State() If Telnet1.State = tcpConnected Then MsgBox "Connected!" End Sub Private Sub Telnet1_Receive() Dim Output As String Telnet1.Receive Output Text1.Text = Output End Sub