FTP is the abbreviation for File Transfer protocol, and Chinese is the document transfer Protocol.
We can connect to the FTP server on the remote host through a client program that supports FTP protocol, upload or download files.
In the TCO/IP protocol, the FTP standard command TCP port number is 21,port mode with a data port of 20.
The task of FTP is to transfer files from one computer to another computer, and is not limited by the operating system.
first, let's take a look at the configuration of the FTP service under Win7.
We'll start by creating a new user to access FTP. Right click on the computer, click Manage, go to local Users and groups, create new user.
Control Panel--programs and features--turn Windows features on or off
Tick all of the Internet Information Services.
Control Panel--management tools
Double-click Open Internet Information Services (IIS) Manager.
In Internet Information Services (IIS) Manager, right-click on the Web site on the left, and tap add FTP site.
Enter the FTP site name and physical path in the site information. Click Next.
In the bindings and SSL settings, add the IP address of the FTP server. Tick automatically start FTP site. SSL is selected as "none". Click Next.
In authentication and authorization information, authentication is checked for basic. Click Done.
Press win + R to open the run, enter Services.msc to open the Services window, locate the Microsoft FTP Service, and start the service.
Back in Internet Information Services (IIS) Manager, right-click on the new FTP site and start FTP.
Internet Information Services (IIS) Manager-->ftp Authorization rules--and edit permissions----------------- Enter the user name in the Select User or group and click Confirm. Check Full Control in the Permissions window.
Internet Information Services (IIS) Manager--Authorization rules--add allow rules,
Enter the newly created user name in the specified user. Read and write in permissions are checked
In the Start Menu , enter window and locate Windows Firewall, click Allow programs or features through Windows Firewall
in the Allow program to select the FTP server through the Windows firewall communication, click "Allow another program to run" below, in the pop-up window, click "Browse" to find C:\Windows\System32\inetsrv\ Inetinfo.exe, click Add, which is the Internet infomation Services in. Select the two boxes that follow. Because FTP is a component of IIS under Win7 , IIS must also be set to allow in the firewall. IIS is not in the default list, so it has to be added manually.
In Windows Firewall, point to Advanced settings, create a new rule in the midpoint of the inbound rule, select the port, and click Next.
Enter 21 in a specific local port and click Next. Click Allow connection and click Next.
Domain, private, and public are checked. Click Next.
Name and description are entered in 21, click Done.
Enter ftp://in the address bar plus the IP address of the FTP server, the login box will appear, enter the user name and password, login success indicates that our FTP server configuration is successful.
The configuration process references the http://www.2cto.com/os/201409/337804.html
FTP send and receive files
With the FTP server configured, we can send and receive files using the FTP protocol.
To create a remote directory
Private Sub Mkftpdir (ByVal path As String, ByVal ftpusr as String, ByVal ftppwd as String) Dim Ftpreq as System.Net.Ft Pwebrequest = Nothing Dim ftpres as System.Net.FtpWebResponse = Nothing Try ftpreq = System.Net.WebRequest.Create (path) ftpreq.credentials = New System.Net.NetworkCredential (ftpusr, ftppwd) Ftpreq.method = System.Net.WebRequestMethods.Ftp.MakeDirectory ftpreq.keepalive = False ftpreq.usepassive = False ftpreq.timeout = ftpres = ftpreq.getresponse () ftpres.close () Catch ex as Exception End tryend Sub
Uploading files locally to an FTP server
Mkftpdir ("ftp://192.168.0.197/21020408", "Liuchuan", "1q2w3e4r") Dim WC as System.Net.WebClient = NOTHINGWC = New System.Net.WebClient () WC. Credentials = New System.Net.NetworkCredential ("Liuchuan", "1q2w3e4r") Dim Responsearray as Byte () = WC. UploadFile ("Ftp://192.168.0.197/21020408/20160125_142843_828256.tif", "E:\ftp\21020408\20160125_142843_828256". TIF ") application.doevents () WC. Dispose ()
FTP Service configuration under vb.net ftp transfer and Win7