Home > Back-end >  Indy TCP client can't read the data server
Indy TCP client can't read the data server

Time:09-30

I use BCB6 take example of indy BasicClientServer there are two code:
Client:
 void __fastcall TForm2: : btnGoClick (TObject * Sender) 
{
TCPClient - & gt; The Connect ().

Try
{
LstMain - & gt; The Items - & gt; Add (TCPClient - & gt; ReadLn ());
}
__finally
{
TCPClient - & gt; Disconnect ();
}
}

Server:
 void __fastcall TfrmServer: : TCPServerExecute (TIdPeerThread * AThread) 
{
AThread - & gt; Connection - & gt; WriteLn (" Hello from Basic Indy Server Server. ");
AThread - & gt; Connection - & gt; Disconnect ();
}


Open the server and client click the button the client can be received the received data server end,

The server then I don't think so, so I download the TCP debugging tools, such as: TCP debugging assistant (V1.9). Exe or TCPUDPDbg. Exe tool here
Also establish a TCP server, using the client program testing, can connect to the server at this time, but this time with the server sends data to the client, the client can't received and the program is easy to no response,
Later also tested with thread to read the data in the client, too, don't know what the reason,

CodePudding user response:

Use wireshark caught look, may be you find server program in distributed data without plus carriage returns symbols, attention should be paid to your readLn

CodePudding user response:

May your server did not send out the data
  • Related