Asynchronous-File-Upload - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Asynchronous File Upload
Set Protocol property to change the protocol in below code
VB code
Dim WithEvents wodFtpDLX As wodFtpDLXCom
Private Sub Form_Load()
    Set wodFtpDLX = New wodFtpDLXCom

    ' Set connection parameters
    wodFtpDLX.HostName = "xx"
    wodFtpDLX.Login = "xx"
    wodFtpDLX.Password = "xx"
    wodFtpDLX.Protocol = FTP

    ' Initiate the connection
    wodFtpDLX.Connect
End Sub

' Connected event is triggered when Connection is successful/or fails. If connection failed
' ErrorCode will be <> 0, and in that case, ErrorText will contain description of an error
' which occured.
Private Sub wodFtpDLX_Connected(ByVal ErrorCode As Long, ByVal ErrorText As String)
    If ErrorCode = 0 Then
        wodFtpDLX.PutFile "C:\local_filename", "/home/"
    End If
End Sub

' When method finishes execution, Done event is triggered. This is where we will disconnect.
Private Sub wodFtpDLX_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)
    wodFtpDLX.Disconnect
End Sub
C# code
private WeOnlyDo.Client.FtpDLX wodFtpDLX;
private void Form1_Load(object sender, EventArgs e)
{
    wodFtpDLX = new WeOnlyDo.Client.FtpDLX();
    // Declare events
    wodFtpDLX.ConnectedEvent +=new WeOnlyDo.Client.FtpDLX.ConnectedDelegate(wodFtpDLX_ConnectedEvent);
    wodFtpDLX.DoneEvent +=new WeOnlyDo.Client.FtpDLX.DoneDelegate(wodFtpDLX_DoneEvent);

    // Set connection parameters
    wodFtpDLX.Hostname = "xx";
    wodFtpDLX.Login = "xx";
    wodFtpDLX.Password = "xx";
    wodFtpDLX.Protocol = WeOnlyDo.Client.Protocols.FTP;

    // Initiate the connection
    wodFtpDLX.Connect();
}

// When method finishes execution, Done event is triggered. This is where we will disconnect.
void wodFtpDLX_DoneEvent(object Sender, WeOnlyDo.Client.FtpDoneArgs Args)
{
    wodFtpDLX.Disconnect();
}

' Connected event is triggered when Connection is successful/or fails. If connection failed
' Args parameter will contain exception of an error
void wodFtpDLX_ConnectedEvent(object Sender, WeOnlyDo.Client.FtpConnectedArgs Args)
{
    wodFtpDLX.PutFile("C:\\local_filename", "/home/");
}
VB.NET code
Dim WithEvents wodFtpDLX As WeOnlyDo.Client.FtpDLX
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    wodFtpDLX = New WeOnlyDo.Client.FtpDLX
    ' Set connection parameters
    wodFtpDLX.Hostname = "xx"
    wodFtpDLX.Login = "xx"
    wodFtpDLX.Password = "xx"
    wodFtpDLX.Protocol = WeOnlyDo.Client.Protocols.FTP

    ' Initiate the connection
    wodFtpDLX.Connect()
End Sub

// Connected event is triggered when Connection is successful/or fails. If connection failed
// Args parameter will contain exception of an error
Private Sub wodFtpDLX_ConnectedEvent(ByVal Sender As Object, ByVal Args As WeOnlyDo.Client.FtpConnectedArgs) Handles wodFtpDLX.ConnectedEvent
    wodFtpDLX.PutFile("C:\\local_filename", "/home/")
End Sub

'When method finishes execution, Done event is triggered. This is where we will disconnect.
Private Sub wodFtpDLX_DoneEvent(ByVal Sender As Object, ByVal Args As WeOnlyDo.Client.FtpDoneArgs) Handles wodFtpDLX.DoneEvent
    wodFtpDLX.Disconnect()
End Sub