Home > Back-end >  Using C Builder realize network connection test procedures
Using C Builder realize network connection test procedures

Time:10-27

Void __fastcall TForm1: : Button1Click (TObject ender)

{//set NMEcho control standard TCP/IP properties

NMEcho1 -> Host=Edit1 -> Text;

NMEcho1 -> TimeOut=StrToInt (Edit2 -> Text);

If (CheckBox1 -> Checked)

NMEcho1 -> Port=StrToInt (Edit3 -> Text);

The else

NMEcho1 -> Port=7;

//Echo in the TCP/IP default port

NMEcho1 -> ReportLevel=Status_Basic;

NMEcho1 -> the Connect ();//connect

RichEdit2 -> Clear ();

for(int i=0; I

//RichEdit1 used to send information to a remote host

RichEdit2 -> Text=RichEdit2 -> Text + NMEcho1 -> Echo (RichEdit1 -> Lines ->

Strings [I]);

NMEcho1 -> Disconnect ();

}

This is I find using c + + Builder to realize the Internet network connection part of the test procedure code this code not understand superior resolution; for(int i=0; I

CodePudding user response:

Echo is a TCP protocol to write back and forth with you sent to the server string,
Method to measure the network connection with ping is better, can use the indy ICMP component implementation

CodePudding user response:

The code above this paragraph for (int I=0; I was not complete, can help to see how to fill

CodePudding user response:

It should be
For (int I=0; i CodePudding user response:

ECHO is the old agreement, can use TCP, UDP can also use the TCP protocol is used in your program. This useful WinSock implementation of the ECHO program, after decompression for ECHO * directory, with detailed comments.
http://download.csdn.net/detail/geoff08zhang/4571358

CodePudding user response:

I also wrote about the code below. Put the code on the thread to run.
 
The ICMP - & gt; The Host=IP;
The ICMP - & gt; PacketSize=32;
The ICMP - & gt; ReceiveTimeout=2000;
The ICMP - & gt; Ping ();
The ICMP - & gt; OnReply=ICMPReply;
//event back ping take
Void __fastcall Ping: ICMPReply (TComponent * ASender, const TReplyStatus * AReplyStatus)
{
Times=AReplyStatus - & gt; MsRoundTripTime;
}
  • Related