Internet service port measurement test program design and real
---- Program utility background ---- Currently, more and more friends in the Internet, more and more problems, the most common is about Domain Name Server (DNS), Mail Service (SMTP) and POP3 The configuration problem of the server. For example, which DNS is selected, 202.96.0.133 is still 202.96.26.243? Recognize ISP's mail server and domain name server IP address, 202.96.26.243 or 202.96.26.245? Another problem is that when we download file, we often face the choice from multiple different hosts (dozens of sunsite Mirror site). So, which site is selected to download is the fastest? The author wrote an application to try to connect the Internet communication port (such as web, email, ftp, etc.) common to Internet, obtain the status of the service port and The response time indicator provides accurate reference data for more efficient use of the Internet. The author is named Tester as Tester, which is not difficult to send from the rear, and Tester can also be used as a simple Internet system. ---- Although Tester also involves its programming method, Tester belongs to the Socket application program. In the case of the model of the TESTER program, we will introduce the model of the TESTER program. Socket Circuit Model ---- Socket is a endpoint of the network communication. We know that network communication is often referred to as two hosts or two processes, through the data between the network, and the process can be tested as a network of the network (SESSION). Each end of the network conversation is the endpoint of the network communication, that is, the minimum single bit of the network communication system. When the network communication is written by using the Socket interface, Socket is an abstract representation of the endpoint of the network communication process. Multi-Number Network Communication Adjusts the Endpoint of Double Party in the Customer Mode of Customer / Server Model. For example, the customer / server model will start the endpoint of the network service request as a customer process or a customer program; the endpoint for the customer request is the server process or server program. ---- For the network communication, each end of the network is needed to have a socket, ie the client socket, and server-side socket. The connection between the two sockets can be connected to the connection.
Although the Socket program is not limited to UNIX system, the Socket interface is still united, but the UNIX system I / O concept is still used when the Socket interface is used, and the Socket interface model is still using an Open wclose.. ---- Socket programming includes the following major steps: Building Socket → Configure Socket → Send data through Socket → Confirmation of Socket → Close Socket. CSocket programming model ---- For beginners with network communication programming, it will feel difficult and complex to use the above-mentioned Socket model. The Visual C MFC (Basic Library) provides some enclosed objects, and these objects are simple, and the program is easy. The Tester program is to realize the classes that are related to the Socket in the MFC. ---- The process of establishing a communication between servor socket and customer socket is as follows. Create a CSocket object. ---- 2. Use the object to produce the Socket handle. ---- 3. If Socket is a guest, call CasyncSocket :: Connect, connect the local Socket and Server Socket. ---- If the Socket is a server, call CasyncSocket :: listen, and start the access request from the client, if you receive the request, call CasyncSocket :: Accept to pick up the processing. ---- 4. Building a CSocketFile object and makes the object with the CSocket parallel. ---- 5. Create a CARCHIVE object to install the address of the data and the data of the data and the data stored (send). Of course, the CARCHIVE object should be connected to the front-sized CSocketFile parallelism. ---- 6. Use the Carchive object to pass data between the guests and server Socket, and the communication between the servers socket and the guest Socket. The value is noted that a given CARCHIVE object can only pass the data upon one direction: or receive or send it. In general, two CARCHIVE objects can be required to implement data for binary pass. ---- 7. Analyze Archive, Socket File, Socket Pair. ---- The above-described memory is shown in the case of the case of the Client Server program ---- Simply speaking, the implementation of the program
---- 1. Socket (Network Communication Substrate) ---- Tester as a customer's Socket communication, including TestSocket (Csocketfile), TestSocketFile (Csocketfile), and Testarchivein, Testarchiveout (Carchive Association), etc.. These parallel buildings are the same as the above CSocket programming model. ---- 2. Clock (used to test the response time between the Internet server port) ---- Tester before the Socket connection standing, call the Clock system function, which can be obtained by using the phase pair difference of the two. Time parameter. The clock function can obtain a time consumption of a system call process, and its return value is the number of units of timers. Tester's time single bit is milliseconds. ---- .... / / Other code ---- Clock-T start = clock (); ---- if (m-psocket -> connect (lpszaddress, nport) ---- { ------ Clock-T end = clock (); -------- ... / / Other code ----} ---- ELSE ---- {------ - Clock-t end = clock (); -------- ... / / Other code ----} ---- ... / / Other code ---- From the program you can see The response time of the Tester record refers to the response time during the connection establishment of the processor throughout the network. This result and network-like case, the performance of the local system has a relationship. In practice, network users are delayed in the actual application process, which is the sum of these various factors. In addition, Tester's response time results are average number of tests in 10 tests. In the case of Tester, Tester is a comprehensive indicator of the response time of the entire network. ---- 3. Interface (Output of the program user interacts, the input and results of the instruction) ---- (1) Input section ---- Tester uses the dialog box object: setUpdlg :: CDialog, in the conversation In the box, use Check, Edit and other controls, and pass these control to the program to pass the test information indicated by the user. ---- (2) The output range ---- Tester is the application program of single document interface (SDI).
The window style is shown in the following block: ---- ... / / Other code ---- ---- CEDITVIEW :: PrecreateWindow (CS); ------ CS.Style = AFX-WS-Default -View | WS-VSCROLL | ES-AutoHScroll | ES-Autovscroll | ES-MULTILINE | ES-NOHIDESEL | ES-READONLY; ---- ... / / Other Code ---- Using Tester's menu function to take each time The test results show files in plain text format. Infix Decoction Box Program Application ---- Tester is the use of the Internet to familiarize the use of the Internet. First, the useer is based on the test needs to fill in the parameter settings dialog box; confirm that the test work is automatically executed by the Tester program, and the test results are displayed in the Tester window. At the same time, the user can also save the test results as text files. ---- Tester's user can test some of the service ports (for example, there is no list of INTERNET services listed in the dialog box). Of course, in this case, users must know the SOCKET port number of the trials that are tested. There are several test results for several test results, only for reference (the author is tested by the 2631 Dial ". ---- The next face gives several test results, for reference only (the author is tested by the 2631 Dial ". Ended host: 163.NET Test time: 10: 37, June 09, 1998
Internet Service Status Response Time (MS)
-------------------------------------------------- ----------------
FTP OFF
SMTP ON 2030
DNS OFF
POP3 on 1050
Http on 380
Terminal host: ihw.com.cn
Test time: 10: 38, June 09, 1998
Internet Service Status Response Time (MS)
-------------------------------------------------- ----------------
FTP OFF
SMTP ON 3670
POP3 on 720
HTTP OFF
Mode host: www.yahoo.com
Test time: 10: 38, June 09, 1998INTERNET Service Status Response Time (MS)
-------------------------------------------------- ----------------
FTP OFF
Telnet OFF
SMTP OFF
DNS OFF
POP3 OFF
HTTP ON 1700
Menue host: www.microsoft.com
Test time: 10: 39, June 09, 1998
Internet Service Status Response Time (MS)
-------------------------------------------------- ----------------
FTP OFF
Telnet OFF
SMTP OFF
DNS OFF
POP3 OFF
Http on 930
Terminal host: www.asia.microsoft.com
Test time: 10: 39, June 09, 1998
Internet Service Status Response Time (MS)
-------------------------------------------------- ----------------
Http on 650
----