In Windows, we often use ping.exe to test network connectivity. The Ping implementation process is very simple. This command will cause the IP layer to send a simple IP packet, usually 32 bytes. After receiving the package, the target party changes the source address and destination address, and resends the package. Of course, some timeout mechanisms need to be added. In fact, we can also use the NMEcho control in the C Builder NetMaster to implement the network connection detection function. First, define the following controls: Three Edit controls: one for receiving the IP address or domain name of the remote host, one for receiving the time-out mechanism set by the user, and the other for setting the port number. Two RichEdit controls: one for sending information to the remote host and the other for receiving information from the remote host. Two CheckBox controls: whether to set the port number. A Button control: used for testing. A StatusBar control is used to display the application status. The program implementation code is as follows: void _ fastcall TForm1: Button1Click (TObject Sender) {// sets the standard TCP/IP attribute NMEcho1-> Host = Edit1-> Text of the NMEcho control; NMEcho1-> TimeOut = StrToInt (Edit2-> Text); if (CheckBox1-> Checked) NMEcho1-> Port = StrToInt (Edit3-> Text ); else NMEcho1-> Port = 7; // default Port number of Echo in TCP/IP NMEcho1-> ReportLevel = Status_Basic; NMEcho1-> Connect (); // establish the connection RichEdit2-> Clear (); for (int I = 0; I // RichEdit1 is used to send information to the remote host RichEdit2-> Text = Rich Edit2-> Text NMEcho1-> Echo (RichEdit1-> Lines-> Strings [I]); NMEcho1-> Disconnect ();} Note: Connect () method, make sure that the connection has been established before receiving data.