Home > Back-end >  Delphi TClientSocket receives the data length is not stable
Delphi TClientSocket receives the data length is not stable

Time:09-21

Excuse me each warrior, have this kind of situation??
The server is a c #
The client for Delphi, use TClientSocket, non-blocking mode

The problem is, when the client receives 10 data encrypted size in more than 2 k, each receiving is different, sometimes can be a one-time all received, sometimes can only receive twice, if it is the second case, the decryption will fail! Guide, o you who met warrior, what reason is this????? !!!!!!!!!!!!!!

CodePudding user response:

After read data written to the cache to achieve your request before processing (decryption)

CodePudding user response:

Problem may be, the client ClienDataSet matching with the server has a problem, 2 k data should be one-time can transmit and receive,

CodePudding user response:

refer to the second floor lyhoo163 response:
problem may be, have a problem with the server client ClienDataSet matching, 2 k data should be one-time can transmit and receive,


The server didn't send for processing the data, as long as have sent
The client is also, as long as you have received

CodePudding user response:

Do communication (network or serial port, etc.), the most basic should consider the subcontract conditions, buffer mechanism is necessary,

CodePudding user response:

Should be communication problem, it's best to do a waiting and then receiving, or send back one size, if you do not receive equal to the cycle

CodePudding user response:

reference 4 floor leeky response:
do communication (network or serial port, etc.), the most basic conditions, to consider the subcontracts buffer mechanism is necessary,

If do not do, is just as simple as I receive, why I say that

CodePudding user response:

This belongs to the sticky package deal with the problem, the situation of the network is very complex, so you expect you send your package all received an event to complete, this is unlikely, if the server to send multiple packages, there may be a one-time received multiple packages, even so, you have to do is put the data in the receive events received are written to the cache, then a separate thread to handle the cache, or can be directly in the receiving position, but not immediately processing, but also should handle the cache,

CodePudding user response:

During transport the router what split or merge package
  • Related