[twsocket] Fw: ICS TFtpclient Bug

2006-08-07 Thread Francois Piette
- Original Message - From: <[EMAIL PROTECTED]> To: "francois.piette" <[EMAIL PROTECTED]> Sent: Tuesday, August 08, 2006 6:53 AM Subject: ICS TFtpclient Bug > francois.piette,hello: > > I found RestPut function of TFtpclient component Bug. RestPut function still is asynchronous,when set

[twsocket] OT; Delphi Turbo

2006-08-07 Thread Angus Robertson - Magenta Systems Ltd
Borland seems to be making some announcements today: http://www.turboexplorer.com/ http://www.eweek.com/article2/0,1895,2000205,00.asp On Aug. 8, the company's Developer Tools Group, which is up for sale, is scheduled to announce single-language versions of the components of Borland Developer

Re: [twsocket] Design verification TCP and COM-Server

2006-08-07 Thread Francois PIETTE
Your design is correct altough you'd better use TWSocketServer instead of reinventing the wheel. You can set MaxClients to one to support only one client at a time. Calling send from another thread is OK because it is protected by a critical section. Note that the prefered design is to have al

[twsocket] Design verification TCP and COM-Server

2006-08-07 Thread Markus Humm
Hello, I'm currently writing a COM-Server which also uses TWSocket for some TCP connection. When the COM-Server's client calls some initializing method on my COM-Server a TCP Socket is created which listens for a incomming connection on a certain port. There should only exist one connection over

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Éric Fleming Bonilha
Hello Wilfried, Thank you so much, you clarified me even more :) Now I know how I need to do the job :) Thank you all Éric Fleming Bonilha - Original Message - From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, August 07, 2006 2:37 PM Subject: R

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Wilfried Mestdagh
Hello Éric, > FSocket is a pointer to socket passed to the thread´s constructor Execute method is ok. Dont forget to ThreadDetach before giving the socket to the thread. Aslo be aware that between the Detach/Attach there is no window assigned and the socket will not be notified of data. It is onl

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Éric Fleming Bonilha
Thanks a lot Arno! :) - Original Message - From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, August 07, 2006 2:13 PM Subject: Re: [twsocket] Multithreaded Client Application Éric Fleming Bonilha wrote: > the Execute should be something like this: Look

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Arno Garrels
Éric Fleming Bonilha wrote: > the Execute should be something like this: Looks OK, principally :) --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Éric Fleming Bonilha
Hello Arno, > To make sure the events are triggered in worker thread context > you must either create the TWSocket instance from worker thread's > Execute method (suggested) or use methods ThreadDetach and > ThreadAttach. So, in this new architecture that I´m trying to make I will create the soc

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Arno Garrels
Éric Fleming Bonilha wrote: > So, one doubt that I have is, if I´m using a thread to process the > socket > messages using the MessageLoop procedure, all the TWSocket events like > OnSessionConnected and OnDataAvailable is triggered using the thread > context, right? So, my handle for those events

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Éric Fleming Bonilha
Thanks for the clarification. Let me explain my scenario. This application is an IP Surveillance software, where the server software is responsible for recording video from IP Cameras, so, to get the video it connects to the camera through the socket. My software today is working on the followi

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Arno Garrels
Éric Fleming Bonilha wrote: > Hello, > > I´m writing a multi-threaded client application > > I read the ICS code and there is written that to make a real multi- > threaded application we should do ThreadAttach and use the > messageloop procedure on the execute method of the working thread. > I´

Re: [twsocket] Multithreaded Client Application

2006-08-07 Thread Fastream Technologies
Hello Eric, You need a message handler for the thread with a while(GetMessage(...)). Peace be upon you, SZ - Original Message - From: "Éric Fleming Bonilha" <[EMAIL PROTECTED]> To: Sent: Monday, August 07, 2006 4:45 PM Subject: [twsocket] Multithreaded Client Application Hello, I´m

[twsocket] Multithreaded Client Application

2006-08-07 Thread Éric Fleming Bonilha
Hello, I´m writing a multi-threaded client application I read the ICS code and there is written that to make a real multi-threaded application we should do ThreadAttach and use the messageloop procedure on the execute method of the working thread. I´m doing this, but, how do I stop this thread?

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Wilfried Mestdagh
Hello, > AFAIK, this tool comes with VC++. Unfortunately I do not have that > installed. I _think_ there is a freeware downloadable version. But there are also other similar tools I think. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz --

Re: [twsocket] Interestingmultithreadingissue:raceconditionwhentriggering anevent handler

2006-08-07 Thread Francois Piette
> Isn't a field "properly aligned in memory" when switch {$A8} is set? That's what the online help let me think. Conclusion: In addition to the code I published, one need to use {$A8} directive (Or the equivalent project option, which is set to 8 by default) for all classes having their event hand

Re: [twsocket] Interestingmultithreadingissue:raceconditionwhentriggering an event handler

2006-08-07 Thread Arno Garrels
Francois Piette wrote: > This raise the following question : Is a field variable in a class > aligned in memory ? (OnMyEvent variable is just a field variable). Isn't a field "properly aligned in memory" when switch {$A8} is set? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/team

Re: [twsocket] Interesting multithreading issue: race condition when triggering an event handler

2006-08-07 Thread Francois Piette
> > This raise the following question : Is a field variable in a class > > aligned in memory ? (OnMyEvent variable is just a field variable). > > I don't know, and it also raises a second question: > > Reads and writes to variables of > > other sizes are not guaranteed to be atomic on any platform

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Fastream Technologies
Hello, AFAIK, this tool comes with VC++. Unfortunately I do not have that installed. Anyway, when you say "random message", I guess you mean some code is posting with wrong message number. Hmmm, strange... Thanks, SubZero - Original Message - From: "Francois Piette" <[EMAIL PROTECTE

Re: [twsocket] Interestingmultithreadingissue:raceconditionwhentriggering an event handler

2006-08-07 Thread Arno Garrels
Francois Piette wrote: > This raise the following question : Is a field variable in a class > aligned in memory ? (OnMyEvent variable is just a field variable). I don't know, and it also raises a second question: > Reads and writes to variables of > other sizes are not guaranteed to be atomic on

Re: [twsocket] Interesting multithreadingissue:raceconditionwhentriggering an event handler

2006-08-07 Thread Francois Piette
This raise the following question : Is a field variable in a class aligned in memory ? (OnMyEvent variable is just a field variable). -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, August

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Francois Piette
You have some part of your code post a random message. I suggest you use Microsoft Spy++ tool to spy on your application messages. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Fastream Technologies" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, Aug

Re: [twsocket] Interesting multithreading issue:raceconditionwhentriggering an event handler

2006-08-07 Thread Arno Garrels
Francois Piette wrote: >> This requires atomic reading/writing of a Pointer (no thread switch >> while read/write), I'm not sure whether this is true. > > I think so since pointer are 32 bits and are accessed by only one > memory cycle. If you look at the Windows API InterlockedXYZ function, > the

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Fastream Technologies
I do not know of any such poster routine. What I do to reproduce the problem is to press F5 on browser which means the connection is opened but then aborted abruptly. HTH, SZ - Original Message - From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, August

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Arno Garrels
Fastream Technologies wrote: > Here is my settings: WH_MAX_MSG = 400 and > > #define WM_HTTP_CLIENT_THREAD_ATTACH (WM_APP + 444) > #define WM_HTTP_CLIENT_THREAD_DETACH (WM_APP + 445) > > these are the two only messages. And still the same exception. With above messages there should be no collis

Re: [twsocket] Interesting multithreading issue: raceconditionwhentriggering an event handler

2006-08-07 Thread Francois Piette
> This requires atomic reading/writing of a Pointer (no thread switch > while read/write), I'm not sure whether this is true. I think so since pointer are 32 bits and are accessed by only one memory cycle. If you look at the Windows API InterlockedXYZ function, there is none to access a single 32

Re: [twsocket] Interesting multithreading issue: raceconditionwhentriggering an event handler

2006-08-07 Thread Fastream Technologies
- Original Message - From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, August 07, 2006 10:40 AM Subject: Re: [twsocket] Interesting multithreading issue: raceconditionwhentriggering an event handler : Hello Arno, : : > This requires atomic reading/wr

Re: [twsocket] Interesting multithreading issue: race conditionwhentriggering an event handler

2006-08-07 Thread Wilfried Mestdagh
Hello Arno, > This requires atomic reading/writing of a Pointer (no thread switch > while read/write), I'm not sure whether this is true. Byte variables > are written/read in one go, there's no ploblem. As far as I know it is also the case with a 32 bit. So should be no problem. --- Rgds, Wilfri

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Fastream Technologies
Here is my settings: WH_MAX_MSG = 400 and #define WM_HTTP_CLIENT_THREAD_ATTACH (WM_APP + 444) #define WM_HTTP_CLIENT_THREAD_DETACH (WM_APP + 445) these are the two only messages. And still the same exception. I test this problem with the reverse proxy and on PHPBB index page on localhost, press

Re: [twsocket] Interesting multithreading issue: race conditionwhentriggering an event handler

2006-08-07 Thread Arno Garrels
Arno Garrels wrote: > Francois PIETTE wrote: >> I've found an interesting multithreading issue which is related not >> The solution is to rewrite the procedure as follow: >> >> Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); >> Line2: var >> Line3: TMyEventProc EventProc; >> Lin

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Arno Garrels
Arno Garrels wrote: > Fastream Technologies wrote: >> I randomly get the test exception fired in my code. > > Make sure your custom messages are in a range above > WH_MAX_MSG!! I mean custom messages posted to a thread, if you post custom messages to a custom window it doesn't matter. --- Arno

Re: [twsocket] Test Exception in WSocket

2006-08-07 Thread Arno Garrels
Fastream Technologies wrote: > I randomly get the test exception fired in my code. Make sure your custom messages are in a range above WH_MAX_MSG!! > It used to give > AV but now after some more work, it now gives this. I do not have any > code such as > > PostMessage(WSocket1.Handle, WM_T

Re: [twsocket] Interesting multithreading issue: race condition whentriggering an event handler

2006-08-07 Thread Arno Garrels
Francois PIETTE wrote: > I've found an interesting multithreading issue which is related not > The solution is to rewrite the procedure as follow: > > Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); > Line2: var > Line3: TMyEventProc EventProc; > Line4: begin > Line5: EventP

[twsocket] Test Exception in WSocket

2006-08-07 Thread Fastream Technologies
Hello, In the WSocket.pas code below (v6): procedure TCustomWSocket.WndProc(var MsgRec: TMessage); begin try with MsgRec do begin if Msg = FMsg_WM_ASYNCSELECT then WMASyncSelect(MsgRec) else if Msg = FMsg_WM_ASYNCGETHOSTBYNAME then