Search code examples
delphitcpclientindy

With Delphi Indy 10.6 and tcpclient is there any way to tell the data format in the input buffer


I'm transferring small byte packets and file streams. Is there any way to tell if the incoming packet is actually a file stream or does it all just look like bytes to the IOHandler?


Solution

  • Is there any way to tell if the incoming packet is actually a file stream or does it all just look like bytes to the IOHandler?

    It is just raw bytes as far as the IOHandler is concerned. It is your responsibility to define and implement a protocol in your application code to control how data packets are structured and identified. For instance, TLD (Type-Length-Data) is a common protocol idiom, where a value identifies the type of data being sent, followed by a value containing the length of the data, followed by the actual data.