The OnCommand event is generated when the client receives a
response to a command from the server.
Syntax
Private Sub object_OnCommand([Index
As Integer,] ByVal ResultCode As Variant,
ByVal ResultString As Variant)
Remarks
The OnCommand event is generated when the client receives a
reply from the server after some action has been taken. The
ResultCode argument contains the numeric result code returned
by the server. The result codes returned from an FTP or HTTP server
fall into one of the following categories:
Value |
Description |
100-199 |
Positive preliminary result. This indicates that the
requested action is being initiated, and the client should expect
another reply from the server before proceeding. |
200-299 |
Positive completion result. This indicates that the server
has successfully completed the requested action. |
300-399 |
Positive intermediate result. This indicates that the
requested action cannot complete until additional information is
provided to the server. |
400-499 |
Transient negative completion result. This indicates that the
requested action did not take place, but the error condition is
temporary and may be attempted again. |
500-599 |
Permanent negative completion result. This indicates that the
requested action did not take place. |
The ResultString argument contains the descriptive string
returned by the server which describes the result. The string
contents may vary depending on the type of server.
The ResultCode property and ResultString property
contain the most recent server responses. Use of the OnCommand
event will allow the application to receive intermediate responses as
well.
Example
Private Sub FileTransfer1_OnCommand(ByVal ResultCode As Variant, _
ByVal ResultString As Variant)
Dim startpos As Integer
Dim crlfpos As Integer
'
' Command response to debug window
'
Debug.Print ResultCode & " " & ResultString
'
' The text control needs a little help with line terminators
' in multi-line responses
'
txtResultStream.Text = txtResultStream.Text & ResultCode & " "
startpos = 1
Do
crlfpos = InStr(startpos, ResultString, Chr(10))
If crlfpos > 0 Then
txtResultStream.Text = txtResultStream.Text & _
Mid(ResultString, startpos, crlfpos - startpos) & vbCrLf
startpos = crlfpos + 1
Else
txtResultStream.Text = txtResultStream.Text & _
Mid(ResultString, startpos) & vbCrLf
Exit Do
End If
Loop
End Sub
See Also
ResultCode Property,
ResultString Property,
Command Method
|