Job Recruitment Website - Ranking of immigration countries - With regard to the use of Internet transmission control controls,

With regard to the use of Internet transmission control controls,

Since the popularity of the Internet, it has become more convenient for people to download files, get instant messages and send emails. Internet can be said to be a great innovation of human science and technology in 2 1 century. Due to this great change, people's lifestyle has also been greatly affected; Online shopping, online information database and online real-time stock trading have mushroomed. In the past, Visual Basic 4.0 did not provide a complete solution for Visual Basic enthusiasts to design Internet programs. Fortunately, VisualBasic 5.0 provides some controls for us to design Internet-related programs. In this paper, the author will use Internet transport controls with Web browser controls to tell readers how to easily design browsers and FTP programs with Visual Basic 5.0.

Introduction to control

Internet transmission control

Internet transport control is a control provided by Microsoft to facilitate users to design Internet applications. It provides two Internet protocols: HTTP and FTP. When we use it, we must first set its access mode. Access methods can be divided into direct connection to the Internet network or connection to the Internet network through a proxy, which completely depends on the nature of our network. After we set the relevant parameters, Internet Transfer control provides two methods: OpenURL and Execute to perform network-related operations, and we can use these two commands to execute some Internet commands. In the following design, the author will explain its usage.

Web browser control

Web browser controls were originally provided by IE 3.0, and will be automatically loaded when IE 3.0 is installed. Visual Basic 5.0 turned it into an internal control. It provides a navigation method, which enables us to connect to the WWW server we want to go to.

Readers must be surprised: since Internet transport controls can connect to the Internet through HTTP and TP protocols, why do we need web browser controls? Because Internet Transfer control does not provide access in graphic mode, the obtained document can only be returned in text mode. If the returned document contains graphics, the generated HTML document must be converted by the program. So I chose the Web browser control to help us transform.

Let me tell readers how to design a web browser and FTP client.

Web browser programming

Step 1: Set network parameters.

First of all, we need to know whether our network system is directly connected to the Internet or through an agent. We can determine how our system connects to the Internet through the following steps:

In the My Computer option, double-click to enter the Control Panel. In the Control Panel option, double-click to enter the Internet option. Select a connection in the Internet dialog box. The dialog box displayed on the screen can determine whether the system connects to the Internet through proxy or dial-up. Because the author's system is connected to the Internet through a proxy, it is necessary to find out the address and port of the proxy server to facilitate the program setting.

Then click the "Settings" option to view its address and port. Then a dialog box will be displayed with "proxy address to be used":172.18.16.65, "port": 8080. Write it down, and you will use these parameters later.

Step 2: Start the design program.

In the file options, select New Project to create a new project, and you will see many options on the screen, such as ActiveX Document.EXE, ActiveX Document.DLL, ActiveX.EXE and ActiveX controls. At this time, you should choose Standard.EXE.

Then, under Project, select the Properties option and change the Project Name to Web Browser under the General option. Add a Web browser control to the screen form, named web1; Then add an Internet transport control named Inet 1.

Add three TextBox controls, named CGISearch, webname and htmlshow, and add a label before CGISearch TextBox to change its title to Search.

Add three button controls named Search, Go and ShowDoc. Change the title to Se respectively.

Arch, go to and display the document.

In order to facilitate readers to understand this relationship, the following table explains it again:

(Text box)

name

-

CGISearch (enter CGI command)

Webname (enter the web address to visit)

Htmlshow (display html text results)

(button)

Name title

-

Search (execute CGI command) search

Go to (operate on the URL) Go to

ShowDoc (show html text results) displays the document.

Then set the properties of Inet 1 as follows:

Accesstype=2-icnamedproxy

Protocol =4-icHTTP

proxy = 172. 18. 16.65:8080

Add the following program code to Go_Click (). This operation will connect to the required web server and display the screen in the box area of web 1:

Private child Go_Click ()

web 1。 Navigation website name. text

End joint

The above procedure uses the Navigate of web 1, which connects the screen to the network site specified in the web name text box.

Add the following program code to htmlshow _Click ():

Private Sub htmlshow _Click ()

a$ = web 1。 LocationURL

ShowDoc。 Text = Inet 1。 OpenURL (one dollar)

End joint

The above process is to read the URL address connected to web 1 through the LocationURL property and temporarily store it in the string a. Then use the OpenURL () command to display the received HTML program code in the text box of ShowDoc.

Add the following program code to CGIserch _Click ():

Private Sub CGIserch _Click ()

Web 1。 Navigate "amedproxy"

User name = "David"

password="2333334 "

Protocol =2-icFTP

proxy = 172. 18. 16.65:8080

We set the user name and password here. When we log in to the FTP server, the server will directly skip the screen for entering the user name and password.

Add a TextBox control and name it FTPgetfile. Add two button controls named FTPget and FTPLink, and change their titles to FTPget and FTPLink respectively.

Add the following program code to FTPLink _Click ():

Private child FTPLink _Click ()

inet 1 . execute " FTP 128 . 9 . 200 . 4 "

End joint

Execute is a method provided by Internet Transfer control to execute FTP utility. We can add FTP command after it, so that we can use any familiar FTP utility to finish our work. The author's FTP server address is 128.9.200.4, so we fill in this address after the FTP command.

Then add the following program code in FTPget _Click ():

Private child FTPLink _Click ()

inet 1 . execute " GET AAA . txt c:\ BBB . txt "

End joint

This operation is to send the aaa.txt file on the FTP server to the client.

Step 2: Test

Run FTPclient, press FTPLink button, and connect to FTP server. Press FTPget But ton to retrieve the file. Have you found an additional bbb.txt file in the C:\ directory? Congratulations on your success!