> This is how it works at the moment.
> I have an array of records. Each record contains a string and an integer.
> The string is used to hold the incoming data and integer hold the timeout
value that counts down.
> As data arrives it is added to the string associated with the correct
client and the timeout is reset to 20 seconds.
> Periodically I check each of the strings in the array to see if <mos> and
</mos> exist.
> If this is the case the message is extracted from the string and
processed.
> The timeout is now turned off.

IMO this is bad design because you have no control on the network speed.
Whatever you select as timeout it is always possible to have an issue with
network speed and congestion. Long timeout will makes the code works most of
the time.

> Occasionally I get issues with data appearing to be corrupt.
Investigations are continuing, but the 
> origin of this e-mail trail was to establish if it worth my while changing
from Delphi TServerSocket 
> to the ICS server component. Is the ICS component known to be better in
whatever respect or is 
> it just an equally good alternative.

ICS component may be the best component, but bad design won't definitely not
solve all issues.
You should REALLY change your design. Please re-read my previous emails.
Summary: Use "</mos>" as LineEnd in TWSocket and let the component assemble
the message for you and trigger the OnDataAvailable only when you have
received the end marker. Use a TTimer to process timeout: if you don't get a
complete message (So no OnDataAvailable), before - let's say - one minute,
then call Abort to close the connection and report an error.

Alternatively, you may parse the XML as data is coming thru and detect when
the ending tag has been reached. This is more complex as you need an XML
parser able to parse a stream as it comes, but this will permit having a
message embedded into another one.

-- 
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to