Cancel Method  
 

Cancels the current blocking network operation.

Syntax

object.Cancel

Parameters

None.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The Cancel method cancels any blocking network operation in the current thread. This is typically used inside an event handler, causing the blocking method to return to the caller with an error indicating that the current operation was canceled. This method sets an internal flag that is periodically checked during a blocking operation, such as waiting for more data to arrive. If the current thread is not blocked at the time that this method is called, it will have no effect.

Example

Private Sub cmdCancel_Click()
    Dim nError As Long
    
    nError = FileTransfer1.Cancel()
    If nError > 0 Then
        MsgBox "Cancel error: " & nError
    End If
End Sub

See Also

Disconnect Method, Reset Method, OnCancel Event