Applying remote control in teaching has become an important means of computerized teaching. There must be a lot of nemutas to understand the programming principle of this network teaching method. Here we use a simple remote control program as an example to illustrate the basic principles of this network programming. This program is programmed by Delphi. In fact, the working mechanism of the program is simple, the controlled party runs a program for listening to the port and receives the packet, and the master sends a packet through the port to the controlled port. According to this principle, we write two programs, one is the control party, and the other is the presserver, running the two programs on two different machines, the controlled machine waits for the control machine to send data then Perform a corresponding operation (such as restart in this example). Two types of controls in Delphi can achieve the above purposes. One type is the controller using ClientSocket, the controlled party uses Serversocket (all in the Internet page), and the other is both parties use nmudp (on the FASTNET page). We know that network transmission is unreliable, that is, the data transmitted data is likely to be lost, and the difference between these two types of controls is the former using TCP (Transfer Control Protocol, Transfer Control Protocol). The TCP protocol is a connection, and each time the two sides establish a connection (or disconnected), it needs to pass three handshakes, but more time-consuming, but the data transmission is reliable; and the latter uses UDP (User DataGram Protocol, User Packet), which is no Connected, the data does not need to be confirmed by the other party, so the speed is fast than TCP, but the data may be lost, so it is unreliable. Since the amount of data required for control is not large, it requires high reliability, it is generally used, and the program describes the following: First step, start the controller program, add the ClientSocket control, name Control, set the host property For the controlled machine IP address, the port attribute is 1234 (port can be set, but do not repeat some default ports, such as 80, etc.). Step 2, add code control.Open in the FormCreate event; // Open the third step of communication with the controlled machine, add a Button, set the caption to "restart" and add the code Control.Socket in the ButtonClick event. Sendtext ('reboot'); // notifies the controlled machine to restart. This completes the work of the control. In the fourth step, start the prosecutor's program, join the Serversocket control, name UnderControl, set the port attribute 1234 (consistent with the port of the controller), the Active property is true; fifth step, in the underControl's OnclientRead event in UnderControl Add code if socket.receivetext = 'reboot' Then EXITWINDOWSEX (EWX_REBOOT, 2); // Restart API function This completes the work of code, then compiles two programs to generate two .exe files are placed in two machines Run (remember to run the controller program under Win98), press the "Restart" button in the controller, and the controlled machine will restart. Remote control machine restarts successfully. Due to the limitations of the space, there is more than a lot of details (such as error handling), and only one function of remote control can be perfect, and interest can be perfect on this, and other functions in network software management, such as Mouse, keyboard lock, shutdown, grab screen, file operation, video transmission, etc., there is not much introduction here, and interesters can access some information in this area.