Re: [twsocket] udp multicast multiple packages - TWSocket bug?
No time to look at your code. Sorry. Could you tell me why you need a thread for TWSocket ? It is asynchronous anyway. If you use a thread, be sure to create TWSocket from the execute method and to add a message pump in your thread. Also make sure to /not/ call the message pump from any of the event generated by TWSocket, directly or indirectly. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Christian Hinske [EMAIL PROTECTED] To: TWSocket@elists.org Sent: Wednesday, January 10, 2007 10:14 PM Subject: [twsocket] udp multicast multiple packages - TWSocket bug? Hi everyone, I am quite new to this mailing list, but I hope anyone can answer my question. The problem I am experiencing is as follows: I get MPEG2 TS-data from a realtime hardware encoder who is multicasting into the local network. I am using TWSocket to receive the datapackes. As some of you might know, MPEG2 Transport Stream (TS) consists of 188 Byte including a 4Byte header, which I can check to see, if the received package is OK. Now, if I am working with only one thread, everything is fine. Once I am adding a second thread (OnDataAvailable - RingBuffer; RingBuffer- Thread2 - File), it seems that OnDataAvailable isn't executed for every event and so buffers the data. The hardware encoder packs 7 MPEG2 packages into one udp-packet, so the standard-size package I get is 1316 Byte. Now, once I am applying the second thread, packages get multiples of that (2632), but they all share the same characteristics: The first header is damaged, 2nd - 7th are fine, 8th - whatever size are empty or random data. I was wondering if maybe TWSocket does not copy the second 1316Byte packet into the buffer-area after the first 1316Byte package if OnDataAvailable hasn't been called in between, but somewhere into the first bytes, which would explain why the first header (with 188 Bytes following is broken). This is how parts of my debugfile look like 1316 Byte udp package received header 1 - OKAY, pid 256 - payload video header 2 - OKAY, pid 256 - payload video header 3 - OKAY, pid 256 - payload video header 4 - OKAY, pid 259 - payload audio header 5 - OKAY, pid 256 - payload video header 6 - OKAY, pid 256 - payload video header 7 - OKAY, pid 256 - payload video 2632 Byte udp package received header 1 - ERROR, pid 19440 header 2 - OKAY, pid 256 header 3 - OKAY, pid 256 header 4 - OKAY, pid 256 header 5 - OKAY, pid 256 header 6 - OKAY, pid 256 header 7 - OKAY, pid 256 header 8 - ERROR, pid 0 header 9 - ERROR, pid 0 header 10 - ERROR, pid 0 header 11 - ERROR, pid 0 header 12 - ERROR, pid 0 header 13 - ERROR, pid 0 header 14 - ERROR, pid 0 The code I am using is in analogy to the TWSocket multithreading example. Code looks like this: type TPos = RECORD Buffersize, Blocksize : Int64; CurrentWPos, CurrentRPos, StartPos : Int64; Diskrepanz : Int64; Richtung : Byte; END; TStreamThread = class(TThread) private FAddrDatei : Pointer; BlockMem : Pointer; procedure CalculateDiscrepancy; procedure WriteMemToFile; procedure ResetPosition; public FDatenspeicher : Pointer; FPos : ^TPos; FAddrLink : Pointer; FAusgabe : TLabel; Ffinalizethread: Boolean; FExchangeFile : Boolean; procedure SetLabel; procedure Execute; override; end; TChangeThread = class(TThread) private procedure ExchangeFile; procedure PrepareFile; public Mode : Byte; procedure Execute; override; end; TRingBuffer = class(TObject) private Speicher : Pointer; Groesse: Int64; Start : Pointer; Writer : Int64; Reader : Int64; Diskrepanz : Int64; Richtung : Integer; public fReadyToWrite : TEvent; fReadyToRead : TEvent; CS : TCriticalSection; constructor Create; procedure GetData(pData : Pointer; pSize : Int64); procedure PutData(pData : Pointer; pSize : Int64); end; var Datei : ARRAY[0..1] OF TFileStream; AddrDatei : Pointer; AddrLink : Pointer; DoExchange: Byte; RootName : String; Socket:TWSocket; StreamThread : TStreamThread; ChangeThread : TChangeThread; ExchangeThread: TChangeThread; public { Public-Deklarationen } DataRes: Pointer; Pos: ^TPos; MyVar : Integer; CritSec: TCriticalSection; Wholesize : Int64; CurrentFileSize: Int64; WrittenSize: Int64; Testvariable : Int64; ReceivedPacks : Int64; MaxSize: Int64; PrerunSize : Int64; FileCount : Integer; StreamID : Integer; RecordingID: Integer; ErrorPacks : Int64;
[twsocket] WinSock error 10035 with TWSocketServer
Hi all, I am using BDS2006 to write a service application that creates a TWSocketServer and waits for connections. When a connection is made, the client sends requests and the service processes the requests and returns the results. This is all being done with LineMode enabled. I've written a similar module in another application recently and that went without a hitch. In this particular case (using code copied from the other application), in OnDataAvailable for the TWSocketClient I type cast the Sender to a TWSocketClient and then call ReceiveStr to retrieve the data. This was resulting in an empty string, despite the fact that by inspecting the object I could see there is data in the receive buffer. Further investigation/testing has revealed that I'm getting error 10035 (operation would block) and wondered why this would happen now and not previously. The only thing I can think of that I'm doing different is that the testing is being done on one machine, whereas I don't think I did that previously. However, I have tested this application with the client on another machine and it exhibits the same problem. Another thing I noticed is that if I do: AnsiString msg = ((TWSocketClient*)Sender)-ReceiveStr(); at the start of the OnDataAvailable event, then I get the data coming through. But I believe (based on the existing application that works) that I should be able to typecast the Sender variable first. Does anyone have any suggestions about what might be going wrong here? Regards, Bevan Edwards -- 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
Re: [twsocket] Fw: Need help with Nov 11 V6 Beta installationunderbcb2006
Hello SZ, I'm just came home, sorry but I have no time to check your vc32.zip. What I did some minutes ago was downloading and installing V6 to a new path, it compiled like charme in the BDS2006 BCB personality. I added the SSL sources, and it again compiled w/o any problem. However I used a package file attached. You must have a mixed codebase, or files are missing in your package? It's your homework to find the problem, compare with current download, use the SSL package/project file attached. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Fastream Technologies wrote: Hello, Has my reply to the below message appeared? With my defines, it does not work! Please see http://www.fastream.com/ics/vc32.zip . - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, January 10, 2007 7:49 PM Subject: Re: [twsocket] Fw: Need help with Nov 11 V6 Beta installation underbcb2006 Hello SZ, It compiles fine here, however I'm using the version before support for HTTP-proxy was added to TWSocket. Have you added OverbyteIcsWinsock2.pas to your custom package? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Fastream Technologies wrote: Resending... - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, January 09, 2007 10:38 AM Subject: Need help with Nov 11 V6 Beta installation under bcb 2006 Hello Francois, Now I downloaded directly from your web site, I have the component package not compiling: Build [Pascal Error] OverbyteIcsWinsock2.pas(159): E2003 Undeclared identifier: 'TListNotification' [Pascal Error] OverbyteIcsWinsock2.pas(252): E2003 Undeclared identifier: 'lnDeleted' [Pascal Error] OverbyteIcsWinsock2.pas(318): E2003 Undeclared identifier: 'GetWinsockErr' [Pascal Fatal Error] pasall.tmp(50): F2063 Could not compile used unit 'C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas' [Fatal Error] F1027 Unit not found: 'System.pas' or binary equivalents (.dcu) [Fatal Error] F1027 Unit not found: 'SysInit.pas' or binary equivalents (.dcu) [Fatal Error] F1026 File not found: 'SysUtils.dcu' [Fatal Error] F1026 File not found: 'SysUtils.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsLibrary.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsLibrary.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsTypes.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsTypes.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWinsock.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWinsock.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWSocket.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWSocket.dcu' [Fatal Error] F1027 Unit not found: 'SysInit.pas' or binary equivalents (.dcu) Search for 'TListNotification' C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas(159): procedure Notify(Ptr: Pointer; Action: TListNotification); override;C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas(249): procedure TInterfaceList.Notify(Ptr: Pointer; Action: TListNotification); I have NOFORMS;NO_DEBUG_LOG;USE_SSL;SECURITY_WIN32; defined. Do you have any idea what can I do? Could you try to do the same and try to install the latest package under BCB2006 please? Regards, SZ -- 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-- 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
Re: [twsocket] Fw: Need help with Nov 11 V6 Betainstallationunderbcb2006
I'm just came home, sorry but I have no time to check your vc32.zip. I checked his files. It worked like a charm. I use BDS2006 with Update 2 installed. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org; Fastream Technologies [EMAIL PROTECTED] Sent: Thursday, January 11, 2007 7:48 PM Subject: Re: [twsocket] Fw: Need help with Nov 11 V6 Betainstallationunderbcb2006 Hello SZ, I'm just came home, sorry but I have no time to check your vc32.zip. What I did some minutes ago was downloading and installing V6 to a new path, it compiled like charme in the BDS2006 BCB personality. I added the SSL sources, and it again compiled w/o any problem. However I used a package file attached. You must have a mixed codebase, or files are missing in your package? It's your homework to find the problem, compare with current download, use the SSL package/project file attached. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Fastream Technologies wrote: Hello, Has my reply to the below message appeared? With my defines, it does not work! Please see http://www.fastream.com/ics/vc32.zip . - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, January 10, 2007 7:49 PM Subject: Re: [twsocket] Fw: Need help with Nov 11 V6 Beta installation underbcb2006 Hello SZ, It compiles fine here, however I'm using the version before support for HTTP-proxy was added to TWSocket. Have you added OverbyteIcsWinsock2.pas to your custom package? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Fastream Technologies wrote: Resending... - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, January 09, 2007 10:38 AM Subject: Need help with Nov 11 V6 Beta installation under bcb 2006 Hello Francois, Now I downloaded directly from your web site, I have the component package not compiling: Build [Pascal Error] OverbyteIcsWinsock2.pas(159): E2003 Undeclared identifier: 'TListNotification' [Pascal Error] OverbyteIcsWinsock2.pas(252): E2003 Undeclared identifier: 'lnDeleted' [Pascal Error] OverbyteIcsWinsock2.pas(318): E2003 Undeclared identifier: 'GetWinsockErr' [Pascal Fatal Error] pasall.tmp(50): F2063 Could not compile used unit 'C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas' [Fatal Error] F1027 Unit not found: 'System.pas' or binary equivalents (.dcu) [Fatal Error] F1027 Unit not found: 'SysInit.pas' or binary equivalents (.dcu) [Fatal Error] F1026 File not found: 'SysUtils.dcu' [Fatal Error] F1026 File not found: 'SysUtils.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsLibrary.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsLibrary.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsTypes.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsTypes.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWinsock.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWinsock.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWSocket.dcu' [Fatal Error] F1026 File not found: 'OverbyteIcsWSocket.dcu' [Fatal Error] F1027 Unit not found: 'SysInit.pas' or binary equivalents (.dcu) Search for 'TListNotification' C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas(159): procedure Notify(Ptr: Pointer; Action: TListNotification); override;C:\Program Files\ICS\Delphi\Vc32\OverbyteIcsWinsock2.pas(249): procedure TInterfaceList.Notify(Ptr: Pointer; Action: TListNotification); I have NOFORMS;NO_DEBUG_LOG;USE_SSL;SECURITY_WIN32; defined. Do you have any idea what can I do? Could you try to do the same and try to install the latest package under BCB2006 please? Regards, SZ -- 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 -- 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 -- 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
Re: [twsocket] WinSock error 10035 with TWSocketServer
resulting in an empty string, despite the fact that by inspecting the object I could see there is data in the receive buffer. There is no receive buffer in the component ! I'm getting error 10035 (operation would block) and wondered why this would happen now and not previously. Error 10035 is not really an error when using non blocking socket. It just means nothing is ready to be read. Instead of ReceiveStr, I suggest you use Receive where you have better control and is faster since it doesn't involve the memory allocation needed for strings. Does anyone have any suggestions about what might be going wrong here? The most common source of probelm is calling the message pump (ProcessMessages and the like) directly or indirectly (For example with a modal form or a simple ShowMessage). -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Bevan Edwards [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, January 11, 2007 7:28 PM Subject: [twsocket] WinSock error 10035 with TWSocketServer Hi all, I am using BDS2006 to write a service application that creates a TWSocketServer and waits for connections. When a connection is made, the client sends requests and the service processes the requests and returns the results. This is all being done with LineMode enabled. I've written a similar module in another application recently and that went without a hitch. In this particular case (using code copied from the other application), in OnDataAvailable for the TWSocketClient I type cast the Sender to a TWSocketClient and then call ReceiveStr to retrieve the data. This was resulting in an empty string, despite the fact that by inspecting the object I could see there is data in the receive buffer. Further investigation/testing has revealed that I'm getting error 10035 (operation would block) and wondered why this would happen now and not previously. The only thing I can think of that I'm doing different is that the testing is being done on one machine, whereas I don't think I did that previously. However, I have tested this application with the client on another machine and it exhibits the same problem. Another thing I noticed is that if I do: AnsiString msg = ((TWSocketClient*)Sender)-ReceiveStr(); at the start of the OnDataAvailable event, then I get the data coming through. But I believe (based on the existing application that works) that I should be able to typecast the Sender variable first. Does anyone have any suggestions about what might be going wrong here? Regards, Bevan Edwards -- 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 -- 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