first of all thanks a lot for your help. Unfortunately, the thing is a bit
different (maybe I haven't chosen the best of my code-fragments to present):
It doesn't make a difference if I am using a ringbuffer or not or if the
TWSocket-component is running in an extra thread or in the main unit.
Let's assume the following scenario:
I have the TWSocket-component which is declared in the main unit TForm1.Socket
: TWSocket; TForm1.Socket:=TWSocket.Create(self);
as well as a TFilestream-Component
TForm1.MyFile : TFilestream; TForm1.MyFile:=TFileSTream.Create('C:\test.ts',
The OnDataAvailable(Sender : TObject; Error : Word) procedure basically doesn't
much apart from getting the data and writing it down to file, eg.
procedure TForm1.OnDataAvailable(Sender : TObject; Error : Word);
var rec : Pointer; rcvsize : Integer;
IF (rcvsize > 0) THEN
So far, everything is running fine, until I introduce a thread, which
completely doesn't have to do anything with the socket at all, e.g.
var x : Int64;
WHILE (not terminated) DO
What happens now is that the size of arriving packets gets bigger. So instead
of getting packets of 1316 Byte every 2ms, I receive 2632 Byte, for example. To
me it appears that TWSocket has buffered two arriving packets, right? However,
every packet > 1316Byte is damaged with the same structure: The first bytes are
trash; Byte 188-1316 perfect; Byte 1317 - 2632 or more = empty!
So that's why I thought that maybe the buffering doesn't work correctly,
meaning that if OnDataAvailable is not executed because of the second thread
and data has to be buffered by TWSocket, it doesn't append the new data at the
end, but copies it into the first bytes, which would explain, why only the
first bytes are damaged, bytes 188-1316 are OK and 1317-x are empty. But maybe
I am completely wrong.
Thanks for any help,
-------- Original-Nachricht --------
Datum: Fri, 12 Jan 2007 15:26:09 +0100
Von: Wilfried Mestdagh <[EMAIL PROTECTED]>
An: ICS support mailing <email@example.com>
Betreff: Re: [twsocket] udp multicast multiple packages -> TWSocket bug?
> I did a quick look. It seems you start (or resume one from pool) a
> thread and give the received data to it.
> Probably you give data again to a thread that is still busy with the
> previous data. You have to check for this somewhere because you tell
> about corrupted data with many threads.
> Rgds, Wilfried [TeamICS]
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
Tel. :(++ 49 89) 36 0 37 445
Mobil :(++49)176 234 10 146
e-mail: [EMAIL PROTECTED]
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be