These are chat archives for IndySockets/Indy
ReadFromStack()is only for Indy 9, and to use
ReadFromSource()instead for Indy 10. For example:
FConn.IOHandler.ReadFromSource(True, 1000, False); if not FConn.IOHandler.InputBufferIsEmpty then ...
TIdIOHandlerclass in the
IOHandleris a property of
TIdTCPConnection. Most of the old reading/writing methods in
TIdTCPConnectionwere moved to
TIdIOHandlerin Indy 10, and some were also renamed
FConn.IOHandler.CheckForDataOnSource(1000); FConn.IOHandler.CheckForDisconnect; if not FConn.IOHandler.InputBufferIsEmpty then ...
CheckForDataOnSourceis the actual read, the
InputBufferis what it reads into. But in most cases, you shouldn't be reading data this way to begin with, even in Indy 9. This approach should only be used when you don't know what you are reading and have to read arbitrary chunks of raw bytes. Most network protocols have structure to them, you should be coding to that structure instead.
TIdIOHandlerhas many methods that deal with structured data (integers, strings, string lists, streams, etc). What do the sent packets actually look like? What kind of protocol are you dealing with?
fixed record structures : TMessageID = record
TsampleSendData = array [1..samples_per_send] of int16;
TWaveFormSample = record
TIdIOHandler.ReadBytes()to read the data, or even
ReadByte, ReadInt16, and
ReadInt32to read the individual values
MessageTypeis the start, look for that. Is
WaveFormDatavariable-length based on
WaveformLength? Or is it always
samples_per_send * 2bytes in size, but only filled with
WaveFormLengthbytes? And what about
DataLength, what does that apply to? And what is with the
EndOfData, and why is it an
TIdIOHandlerdoes have a
(Post|Send)Message(), queues, etc. Inter-thread communication is a very broad topic.