473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

sftp for Visual basic

Hi,

I'm looking for some sample code to do the sftp (both upload and download). I hope that someone could give me some direction to start with.

Thank you,

Will
Mar 17 '06 #1
4 11732
resta
1
Hi,
I have same problem with sftp in visual basic do you had code for it,
I really need the solve it.
please help me...

thanks,



Resta
Apr 27 '07 #2
Hi,
here is a VB.NET sample for connecting to the SFTP server, and uploading/downloading files.

The code is taken from Rebex [URL removed] website.

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'create client, connect and log in 
  3. Dim client As New SFtp
  4. client.Connect("sftp.example.org")
  5. client.Login("username", "password")
  6.  
  7. ' upload the 'test.zip' file to the current directory at the server 
  8. client.PutFile("c:\data\test.zip", "test.zip")
  9.  
  10. ' upload the 'index.html' file to the specified directory at the server 
  11. client.PutFile("c:\data\index.html", "/wwwroot/index.html")
  12.  
  13. ' download the 'test.zip' file from the current directory at the server 
  14. client.GetFile("test.zip", "c:\data\test.zip")
  15.  
  16. ' upload the 'index.html' file to the specified directory at the server 
  17. client.GetFile("/wwwroot/index.html", "c:\data\index.html")
  18.  
Jul 29 '08 #3
I have this code:

Uploading file:
Expand|Select|Wrap|Line Numbers
  1. ' Create a new instance.
  2. Dim client As New Sftp()
  3. ' Connect to the SFTP server.
  4. client.Connect("localhost")
  5. ' Authenticate.
  6. client.Authenticate("test", "test")
  7. ' ...
  8. ' Upload local file 'c:\test.dat' to '/test.dat'.
  9. client.UploadFile("c:\test.dat", "/test.dat")
  10. ' ...
  11. ' Disconnect.
  12. client.Disconnect()
Downloading file:
Expand|Select|Wrap|Line Numbers
  1. ' Create a new instance.
  2. Dim client As New Sftp()
  3. ' Connect to the SFTP server.
  4. client.Connect("localhost")
  5. ' Authenticate.
  6. client.Authenticate("test", "test")
  7. ' ...
  8. ' Download remote file '/test.dat' to 'c:\test.dat'
  9. client.DownloadFile("/test.dat", "c:\test.dat")
  10. ' ...
  11. ' Disconnect.
  12. client.Disconnect()
In order to run the code, you may need to download this SFTP component from CSoft to run the code. It's not free but it will help you.
May 24 '10 #4
You can also try the Ultimate SFTP component for .NET from ATP, Inc.
Feb 21 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: pix | last post by:
Hello, I would like to start learning Visual Basic, and I was wondering if there are any recomendations to any ebooks, or actual books for that matter. I have my eye on this book by John Smiley,...
2
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or...
2
by: Ralph | last post by:
I used to have Visual Basic .net std. 2003 installed on WinXP SP1A. But I found it too hard to upgrade WinXP to SP2. Now, I do have WinXP SP2 installed, but I am having problems installing...
2
by: frossberg | last post by:
Hello! I tried to install the Visual Basic.NET Resource Kit (http://msdn.microsoft.com/vbasic/vbrkit/) but obviously something went very wrong and now it sems impossible both to repair and to...
5
by: Microsoft | last post by:
Hi, I have Visual Basic .net 2003 (Standard Edition) & SQL Server 2000 Developer Edition. When trying to create a connection in the server explorer from the .net IDE I get a number of problems;...
4
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
4
by: Chris Asaipillai | last post by:
Hi there My compay has a number of Visual Basic 6 applications which are front endeed onto either SQL Server or Microsoft Access databases. Now we are in process of planning to re-write these...
11
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I have seen the terms Visual Basic 2005 and VB.NET. It seems that sometimes they seem to be referring to the same thing but sometimes they are not. I also run into terms like VB9 and VB10.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.