Write-String-variable-into-a-remote-file-Simple - 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] **

Write String variable into a remote file - Simple
VB code
Dim wodFtpDLX As wodFtpDLXCom
Private Sub Form_Load()

    Set wodFtpDLX = New wodFtpDLXCom

    wodFtpDLX.HostName = "xx"
    wodFtpDLX.Login = "xx"
    wodFtpDLX.Password = "xx"
    wodFtpDLX.Blocking = True

    ' It's time to connect to server. All we now need to do is call Connect method.
    wodFtpDLX.Connect

    ' Create String object which will hold data to write.
    Dim InputString As String
    InputString = "Something to write to file."
    
    ' Write String variable to our MemoryStream.
    wodFtpDLX.PutData InputString, "/home/remote_filename.txt"

    ' We're done. Disconnect from server.
    wodFtpDLX.Disconnect

End Sub
C# code
private WeOnlyDo.Client.FtpDLX wodFtpDLX;
private void Form1_Load(object sender, EventArgs e)
{
    wodFtpDLX = new WeOnlyDo.Client.FtpDLX();

    wodFtpDLX.Hostname = "xx";
    wodFtpDLX.Login = "xx";
    wodFtpDLX.Password = "xx";
    wodFtpDLX.Blocking = true;

    // It's time to connect to server. All we now need to do is call Connect method.
    wodFtpDLX.Connect();

    // Initialize MemoryStream object
    System.IO.MemoryStream MemStream = new System.IO.MemoryStream();

    // Initialize StreamWriter object for writing into MemoreStream.
    System.IO.StreamWriter strWriter = new System.IO.StreamWriter(MemStream);

    // Write String variable to our MemoryStream.
    String Input = "Something to write to file.";
    strWriter.Write(Input);
    strWriter.Flush();

    // Finally, write our data to remote file.
    wodFtpDLX.PutFile(MemStream, "/home/remote_filename.txt");

    // We're done. Disconnect from server.
    wodFtpDLX.Disconnect();
}
VB.NET code
Dim 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()

    wodFtpDLX.Hostname = "xx"
    wodFtpDLX.Login = "xx"
    wodFtpDLX.Password = "xx"
    wodFtpDLX.Blocking = True

    ' It's time to connect to server. All we now need to do is call Connect method.
    wodFtpDLX.Connect()

    ' Initialize MemoryStream object
    Dim MemStream As System.IO.MemoryStream
    MemStream = New System.IO.MemoryStream

    ' Initialize StreamWriter object for writing into MemoreStream.
    Dim strWriter As System.IO.StreamWriter
    strWriter = New System.IO.StreamWriter(MemStream)

    ' Write String variable to our MemoryStream.
    Dim Input As String = "Something to write to file."
    strWriter.Write(Input)
    strWriter.Flush()

    ' Finally, write our data to remote file.
    wodFtpDLX.PutFile(MemStream, "/home/remote_filename.txt")

    ' We're done. Disconnect from server.
    wodFtpDLX.Disconnect()
End Sub