Ftp Object : State Event |
Visual Basic |
---|
Public Event State() |
WARNING Timeout must be 0 when calling methods from within an event. Failure to observe this rule may cause reentrancy problems and unpredictable results.
The Login method (used to initiate an active connection) normally causes the State property to transition from tcpClosed to tcpConnecting (while resources are being allocated and the connection is being established) to tcpConnected, at which time communications activity can start.
The Logout method normally causes the State property to transition from tcpConnected to tcpClosing (while resources are being de-allocated) to tcpClosed.
Private Sub Ftp1_State() On Error Goto OnError ' use intrinsic error handling ' State of the Telnet1 connection has changed...put up user feedback Select Case Ftp1.State Case tcpConnecting Label1.Caption = "Client Connecting..." Case tcpConnected Label2.Caption = "Client Connected to " & Tcp1.RemoteAddress Case tcpClosing Label3.Caption = "Client Closing..." Case tcpClosed Label4.Caption = "Client Closed" End Select Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub