[twsocket] Http - access table or tabular sheet
Hi to all, Is it possible to make - access a table or tabular sheet to access an http site with ics components. Http sheet should have a very simple list, and should hold about 200 records, it is not needed to show this site like a regular http sheet: CurstNr OrderNr - 110 222 315 I would like to: 1. update this table 2. consult this table Thanks for any suggestions or reading material Greetings Werner -- 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] Http - access table or tabular sheet
Hello Werner, Sorry but your question is not clear, where is this tabbed data located ? if it is on a web page then simply download the page and read the tabs inside, ics will have nothing to do with this data analyzing. regards. W Hi to all, W Is it possible to make - access a table or tabular sheet to access an http site with ics components. W Http sheet should have a very simple list, and should hold about 200 records, it is not needed to show this site like a regular http sheet: W CurstNr OrderNr W - W 110 W 222 W 315 W I would like to: W 1. update this table W 2. consult this table W Thanks for any suggestions or reading material W Greetings W Werner -- 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] Server problem (leaking memory)
Ok here is the core of the problem: The waitforsinglemessage solution worked for the single thread for each connection case but since it is blocking, cannot be used for the 32 clients per thread proxy. Here is the problem: This is the worker thread: void __fastcall THTTPThread::processServerThreadMessage(const MSG msg) { if(msg.message == WM_HTTP_CLIENT_THREAD_ATTACH) { httpServerClientClass *clientObject = (httpServerClientClass*)msg.wParam; clientObject-ThreadAttach(); PostThreadMessage(clientObject-serverThread-ThreadID, WM_SYNCED, (WPARAM)clientObject, 0); } ... } // this function is called for every GetMessage And this is the server thread: void __fastcall httpServerThread::HTTPServerClientConnected(TObject *Sender, TObject *Client, WORD Error) { httpServerClientClass *clientObject = (httpServerClientClass*)Client; clientObject-serverPermissions = serverPermissions; clientObject-FServer = HTTPServer; clientObject-URLPermissions = serverPermissions-seekURLPermission(DEFAULTDOMAIN, true); clientObject-affinityThread = httpServerClientThreadManager-getHTTPThread(); clientObject-ThreadDetach(); while(!PostThreadMessage(clientObject-affinityThread-ThreadID, WM_HTTP_CLIENT_THREAD_ATTACH, (WPARAM)clientObject, 0)) ::Sleep(1); MSG msg; try { while(!Terminated GetMessage(msg, NULL, 0, 0)) { if(msg.message == WM_SYNCED msg.wParam == (WPARAM)clientObject) break; // NEVER COMES HERE!! else processServerThreadMessage(msg); } } catch(ESocketException e) { } catch(...) { } //WaitForSingleObject(clientObject-attachedEvent, INFINITE); HTTPServerClientPostConnect(clientObject); } //--- What I want is simple: I first want to have the thread attached before exiting the function and moreover, I need other client run smoothly. Hope you can help. Best Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 10:34 PM Subject: Re: [twsocket] Server problem (leaking memory) Arno Garrels wrote: Fastream Technologies wrote: Ok figured out your logic. It gives the same performance/memory leak as before. I think there is a problem with another part... This may not be your current problem, but it is a problem. - destroy the client object fully - have the FClientList routine run in the listener thread as it is unprotected! - Could you advise a shut down destruction routine (Pascal now ok). Currently I've no idea how to do that, but I'm pretty sure it is possible. This stuff is rather tricky, my solution is in TWSocketThrdServer, but of course many other solutions are possible. Forgot to mention that I would derive a MT TWsocketServer first that behaves as I like. It often helps a lot to reduce the problem to the basics. THttpServer is derived from TWSocketServer. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 6:01 PM Subject: Re: [twsocket] Server problem (leaking memory) Hi, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 4:25 PM Subject: Re: [twsocket] Server problem (leaking memory) Fastream Technologies wrote: You say that you post a message to the worker thread to let it ThreadAttach. What do you do until the worker thread has attached?? You cannot just post a message, you have to wait until the workerthread has allocated the window. What do you suggest? What should I do? Would SendMessage work? But there is no SendThreadMessage! If you have one thread per connection you post your message, then in a loop check a boolean flag that is set from within the worker thread when ThreadAttach returned. If you have multiple connections per thread you could use messages combined with Windows events or other sync-objects. The latter design is demonstrated with TWSocketThrdServer that I made to test ICS SSL in a multi-threaded environment. One connection per thread is demonstrated in demo ThrdSrv. I saw your waitformultiplemessages design and it works with attach. But there is a big problem with detach: In my code, triggersessionclosed runs in the context of worker thread!!! What I want: - destroy the client object fully - have the FClientList routine run in the listener thread as it is unprotected! -
Re: [twsocket] Under what conditions THttpServer would stop?
No it is not. Please see my lastest post. I think the problem is in ThreadAttach under MT environments. Regards, SZ - Original Message - From: Francois Piette [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, March 22, 2006 11:25 AM Subject: Re: [twsocket] Under what conditions THttpServer would stop? Is the listening socket still listening ? Whatr I already had is a bug in a totally different part of my application which closed the listening socket by error ! This happend if by chance you call CloseHandle with an invalid argument which is unfortunately the listening socket handle. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, March 21, 2006 9:50 PM Subject: [twsocket] Under what conditions THttpServer would stop? Hello, In the latest version that I have in which I implemented the Arno's TSSLMTServer method, and even in old versions, after some load, the server component halts. I see nothing strange in the task manager: 9MB ram used up, 459 handles, etc.. Could this be related to TIME_WAIT (I HIGHLY DOUBT IT as Apache/IIS do not act like that). Or is this a school-kind synchronization problem? BTW, I am using Socrates--an old freeware stress test tool. I contacted its author to ask for distribution permission as it is getting rare on the web and he did not reply. What do you think should we do to not lose this great tool? Best 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] Http - access table or tabular sheet
Hi Francois So if I want to make only one simple modification, let's say one record, I can do this with http get - modified - then post the page again ? thx - Oorspronkelijk bericht - Van: Francois Piette [EMAIL PROTECTED] Aan: ICS support mailing twsocket@elists.org Verzonden: woensdag, maart 22, 2006 10:22 Onderwerp: Re: [twsocket] Http - access table or tabular sheet Yes this data is on a web page, on my server provider. The thing is, that many users should be able to update and read this data. So for example, CustNr 2, will update his ordernr to 25, then I need from time to time to read his actual orderNr. So I like to create a dynamic site. I'm very new on this, and know only how to read a fix http page. As far as a client component is concerned, reading a dynamic page is exactly the same as reading a static page. At least when dynamic aspect is built at server side. Client side dynamic is handled by JavaScript, ActiveX, JavaApplet and similar technologies. Those technologies are beyond a HTTP component. Server side dynamic page (ASP, PHP, Delphi, JSP, CGI, ISAPI and many others) make no difference for the client. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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] Http - access table or tabular sheet
So if I want to make only one simple modification, let's say one record, I can do this with http get - modified - then post the page again ? No, it doesn't work like that. You have to build something at server side to handle you dynamic page. What kind of server do you have ? Are you willing to build it using ICS HTTP server component ? -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be thx - Oorspronkelijk bericht - Van: Francois Piette [EMAIL PROTECTED] Aan: ICS support mailing twsocket@elists.org Verzonden: woensdag, maart 22, 2006 10:22 Onderwerp: Re: [twsocket] Http - access table or tabular sheet Yes this data is on a web page, on my server provider. The thing is, that many users should be able to update and read this data. So for example, CustNr 2, will update his ordernr to 25, then I need from time to time to read his actual orderNr. So I like to create a dynamic site. I'm very new on this, and know only how to read a fix http page. As far as a client component is concerned, reading a dynamic page is exactly the same as reading a static page. At least when dynamic aspect is built at server side. Client side dynamic is handled by JavaScript, ActiveX, JavaApplet and similar technologies. Those technologies are beyond a HTTP component. Server side dynamic page (ASP, PHP, Delphi, JSP, CGI, ISAPI and many others) make no difference for the client. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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 -- 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] Http - access table or tabular sheet
all is very new to me... I have x webspace with my service provider. I want to create 1 dynamic page on it. - can I put an ics Http Server on it? or do I need to create other stuff first - or do I need to create this Http Server on my computer, but then I need to run it my computer all the time, so users can access it? thx to enlight this - Oorspronkelijk bericht - Van: Francois Piette [EMAIL PROTECTED] Aan: ICS support mailing twsocket@elists.org Verzonden: woensdag, maart 22, 2006 12:01 Onderwerp: Re: [twsocket] Http - access table or tabular sheet So if I want to make only one simple modification, let's say one record, I can do this with http get - modified - then post the page again ? No, it doesn't work like that. You have to build something at server side to handle you dynamic page. What kind of server do you have ? Are you willing to build it using ICS HTTP server component ? -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be thx - Oorspronkelijk bericht - Van: Francois Piette [EMAIL PROTECTED] Aan: ICS support mailing twsocket@elists.org Verzonden: woensdag, maart 22, 2006 10:22 Onderwerp: Re: [twsocket] Http - access table or tabular sheet Yes this data is on a web page, on my server provider. The thing is, that many users should be able to update and read this data. So for example, CustNr 2, will update his ordernr to 25, then I need from time to time to read his actual orderNr. So I like to create a dynamic site. I'm very new on this, and know only how to read a fix http page. As far as a client component is concerned, reading a dynamic page is exactly the same as reading a static page. At least when dynamic aspect is built at server side. Client side dynamic is handled by JavaScript, ActiveX, JavaApplet and similar technologies. Those technologies are beyond a HTTP component. Server side dynamic page (ASP, PHP, Delphi, JSP, CGI, ISAPI and many others) make no difference for the client. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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 -- 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] Http - access table or tabular sheet
This have nothing to do with ICS, ICS is here to get web page and put web page, the way your web server produce the document or retrieve it is not an ICS concern, this is more PHP/ASP. But everything you do with ASP/PHP can be done probably more easily with ICS HTTP server component and some Delphi code ! -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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] Http - access table or tabular sheet
I have x webspace with my service provider. I want to create 1 dynamic page on it. - can I put an ics Http Server on it? You have to ask your service provider if you are allowed to run an executable and have it use publicly available TCP port (obviously different than the sandradt port 80 which is already in use by the webserver). or do I need to create other stuff first If you can't run your ICS/Delphi program, then you msut use whatever your provider allow. Probably something like ASP or PHP. - or do I need to create this Http Server on my computer, but then I need to run it my computer all the time, so users can access it? Yes you can. do that. You can easily be your own service provider. Not a big deal. You buy a fixed IP with DNS service and the required bandwidth and connect your own server. Then you do whatever you like, including writing your own server using Delphi and ICS components. You can also frequently drop your own computer in you provider computer room, using his network. You access it remotely to configure and maintain it. btw: This mailing list is for discussing ICS component. So you'are welcome to ask questions related to ICS use. For example questions about how to write your dynamic website with ICS or questions about how to access any website using ICS. Please keep on topic when asking. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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] No download from www.overbyte.be
I can't download anymore from Your WWW when cliking a link. Eg. 'javascript:top.StartDownload('eng',%20'arch/ics.zip');' Any idea of why ?? I checked the website. It works from here. So the problem is probably at your computer. Check if you have cookies and javascript enabled in your browser. Check any misconfigured security product which might block javascript or secondary browser window. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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] Server problem (leaking memory)
Ok I can confirm this is the problem (below). There seems to be other messages for the same client in the queue that are processed before the WM_SYNCED so this spoils everything. SendDocument is called before this function ends!! Any ideas? Thanks, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, March 22, 2006 10:40 AM Subject: Re: [twsocket] Server problem (leaking memory) Ok here is the core of the problem: The waitforsinglemessage solution worked for the single thread for each connection case but since it is blocking, cannot be used for the 32 clients per thread proxy. Here is the problem: This is the worker thread: void __fastcall THTTPThread::processServerThreadMessage(const MSG msg) { if(msg.message == WM_HTTP_CLIENT_THREAD_ATTACH) { httpServerClientClass *clientObject = (httpServerClientClass*)msg.wParam; clientObject-ThreadAttach(); PostThreadMessage(clientObject-serverThread-ThreadID, WM_SYNCED, (WPARAM)clientObject, 0); } ... } // this function is called for every GetMessage And this is the server thread: void __fastcall httpServerThread::HTTPServerClientConnected(TObject *Sender, TObject *Client, WORD Error) { httpServerClientClass *clientObject = (httpServerClientClass*)Client; clientObject-serverPermissions = serverPermissions; clientObject-FServer = HTTPServer; clientObject-URLPermissions = serverPermissions-seekURLPermission(DEFAULTDOMAIN, true); clientObject-affinityThread = httpServerClientThreadManager-getHTTPThread(); clientObject-ThreadDetach(); while(!PostThreadMessage(clientObject-affinityThread-ThreadID, WM_HTTP_CLIENT_THREAD_ATTACH, (WPARAM)clientObject, 0)) ::Sleep(1); MSG msg; try { while(!Terminated GetMessage(msg, NULL, 0, 0)) { if(msg.message == WM_SYNCED msg.wParam == (WPARAM)clientObject) break; // NEVER COMES HERE!! else processServerThreadMessage(msg); } } catch(ESocketException e) { } catch(...) { } //WaitForSingleObject(clientObject-attachedEvent, INFINITE); HTTPServerClientPostConnect(clientObject); } //--- What I want is simple: I first want to have the thread attached before exiting the function and moreover, I need other client run smoothly. Hope you can help. Best Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 10:34 PM Subject: Re: [twsocket] Server problem (leaking memory) Arno Garrels wrote: Fastream Technologies wrote: Ok figured out your logic. It gives the same performance/memory leak as before. I think there is a problem with another part... This may not be your current problem, but it is a problem. - destroy the client object fully - have the FClientList routine run in the listener thread as it is unprotected! - Could you advise a shut down destruction routine (Pascal now ok). Currently I've no idea how to do that, but I'm pretty sure it is possible. This stuff is rather tricky, my solution is in TWSocketThrdServer, but of course many other solutions are possible. Forgot to mention that I would derive a MT TWsocketServer first that behaves as I like. It often helps a lot to reduce the problem to the basics. THttpServer is derived from TWSocketServer. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 6:01 PM Subject: Re: [twsocket] Server problem (leaking memory) Hi, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 4:25 PM Subject: Re: [twsocket] Server problem (leaking memory) Fastream Technologies wrote: You say that you post a message to the worker thread to let it ThreadAttach. What do you do until the worker thread has attached?? You cannot just post a message, you have to wait until the workerthread has allocated the window. What do you suggest? What should I do? Would SendMessage work? But there is no SendThreadMessage! If you have one thread per connection you post your message, then in a loop check a boolean flag that is set from within the worker thread when ThreadAttach returned. If you have multiple connections per thread you could use messages combined with Windows events or other sync-objects. The
Re: [twsocket] Http - access table or tabular sheet
Hello, I also think you should learn more what is a web server, statis and dynamic web pages, server side scripting (PHP/ASP), so you may better understand this technology and know if delpih/ics may be usefull to you. regards. FT You just need an FTP client to upload your files to your ISP. You do not FT need to run ICS or any other web server or leave your computer open. Your FT ISP does all of it for you. FT Regards, FT SZ FT - Original Message - FT From: Werner [EMAIL PROTECTED] FT To: ICS support mailing twsocket@elists.org FT Sent: Wednesday, March 22, 2006 2:10 PM FT Subject: Re: [twsocket] Http - access table or tabular sheet all is very new to me... I have x webspace with my service provider. I want to create 1 dynamic page on it. - can I put an ics Http Server on it? or do I need to create other stuff first - or do I need to create this Http Server on my computer, but then I need to run it my computer all the time, so users can access it? thx to enlight this - Oorspronkelijk bericht - Van: Francois Piette [EMAIL PROTECTED] Aan: ICS support mailing twsocket@elists.org Verzonden: woensdag, maart 22, 2006 12:01 Onderwerp: Re: [twsocket] Http - access table or tabular sheet So if I want to make only one simple modification, let's say one record, I can do this with http get - modified - then post the page again ? No, it doesn't work like that. You have to build something at server side to handle you dynamic page. What kind of server do you have ? Are you willing to build it using ICS HTTP server component ? -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be thx - Oorspronkelijk bericht - Van: Francois Piette [EMAIL PROTECTED] Aan: ICS support mailing twsocket@elists.org Verzonden: woensdag, maart 22, 2006 10:22 Onderwerp: Re: [twsocket] Http - access table or tabular sheet Yes this data is on a web page, on my server provider. The thing is, that many users should be able to update and read this data. So for example, CustNr 2, will update his ordernr to 25, then I need from time to time to read his actual orderNr. So I like to create a dynamic site. I'm very new on this, and know only how to read a fix http page. As far as a client component is concerned, reading a dynamic page is exactly the same as reading a static page. At least when dynamic aspect is built at server side. Client side dynamic is handled by JavaScript, ActiveX, JavaApplet and similar technologies. Those technologies are beyond a HTTP component. Server side dynamic page (ASP, PHP, Delphi, JSP, CGI, ISAPI and many others) make no difference for the client. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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 -- 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] Server problem (leaking memory)
So no answer means there is no way to do this? Could this even be impossible?? Regards, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, March 22, 2006 2:07 PM Subject: Re: [twsocket] Server problem (leaking memory) Ok I can confirm this is the problem (below). There seems to be other messages for the same client in the queue that are processed before the WM_SYNCED so this spoils everything. SendDocument is called before this function ends!! Any ideas? Thanks, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, March 22, 2006 10:40 AM Subject: Re: [twsocket] Server problem (leaking memory) Ok here is the core of the problem: The waitforsinglemessage solution worked for the single thread for each connection case but since it is blocking, cannot be used for the 32 clients per thread proxy. Here is the problem: This is the worker thread: void __fastcall THTTPThread::processServerThreadMessage(const MSG msg) { if(msg.message == WM_HTTP_CLIENT_THREAD_ATTACH) { httpServerClientClass *clientObject = (httpServerClientClass*)msg.wParam; clientObject-ThreadAttach(); PostThreadMessage(clientObject-serverThread-ThreadID, WM_SYNCED, (WPARAM)clientObject, 0); } ... } // this function is called for every GetMessage And this is the server thread: void __fastcall httpServerThread::HTTPServerClientConnected(TObject *Sender, TObject *Client, WORD Error) { httpServerClientClass *clientObject = (httpServerClientClass*)Client; clientObject-serverPermissions = serverPermissions; clientObject-FServer = HTTPServer; clientObject-URLPermissions = serverPermissions-seekURLPermission(DEFAULTDOMAIN, true); clientObject-affinityThread = httpServerClientThreadManager-getHTTPThread(); clientObject-ThreadDetach(); while(!PostThreadMessage(clientObject-affinityThread-ThreadID, WM_HTTP_CLIENT_THREAD_ATTACH, (WPARAM)clientObject, 0)) ::Sleep(1); MSG msg; try { while(!Terminated GetMessage(msg, NULL, 0, 0)) { if(msg.message == WM_SYNCED msg.wParam == (WPARAM)clientObject) break; // NEVER COMES HERE!! else processServerThreadMessage(msg); } } catch(ESocketException e) { } catch(...) { } //WaitForSingleObject(clientObject-attachedEvent, INFINITE); HTTPServerClientPostConnect(clientObject); } //--- What I want is simple: I first want to have the thread attached before exiting the function and moreover, I need other client run smoothly. Hope you can help. Best Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 10:34 PM Subject: Re: [twsocket] Server problem (leaking memory) Arno Garrels wrote: Fastream Technologies wrote: Ok figured out your logic. It gives the same performance/memory leak as before. I think there is a problem with another part... This may not be your current problem, but it is a problem. - destroy the client object fully - have the FClientList routine run in the listener thread as it is unprotected! - Could you advise a shut down destruction routine (Pascal now ok). Currently I've no idea how to do that, but I'm pretty sure it is possible. This stuff is rather tricky, my solution is in TWSocketThrdServer, but of course many other solutions are possible. Forgot to mention that I would derive a MT TWsocketServer first that behaves as I like. It often helps a lot to reduce the problem to the basics. THttpServer is derived from TWSocketServer. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 6:01 PM Subject: Re: [twsocket] Server problem (leaking memory) Hi, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, March 20, 2006 4:25 PM Subject: Re: [twsocket] Server problem (leaking memory) Fastream Technologies wrote: You say that you post a message to the worker thread to let it ThreadAttach. What do you do until the worker thread has attached?? You cannot just post a message, you have to wait until the workerthread has allocated the window. What do you suggest? What should I do? Would SendMessage work? But there is no
[twsocket] WSocketTS
Hello, Assuming this is the official MT implementation for ICS, I am looking at the below code: {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} function TWSocketThrdServer.ClientAttachThread( Client: TWSocketThrdClient): TWsClientThread; var WaitRes : Longword; H : array[0..1] of THandle; begin if Client.Handle 0 then Client.ThreadDetach; //LogDebug(IntToHex(Integer(Client), 8) + ' Main Thread Detached'); Client.FClientThread := nil; Client.FServer := Self; Result := AcquireThread; H[1] := Result.Handle; { Wait until the thread has initialized its message queue } if not Result.FReadyForMsgs then begin H[0] := Result.FEventArray[cteiThreadReady]; WaitRes := WaitForMultipleObjects(2, @H, FALSE, Infinite); if WaitRes = WAIT_FAILED then raise Exception.Create('Wait failed ' + SysErrorMessage(GetLastError)) else if WaitRes = WAIT_OBJECT_0 + 1 then raise Exception.Create('Thread terminated while waiting'); end; if not PostThreadMessage(Result.ThreadID, WM_THREAD_ADD_CLIENT, Integer(Client), 0) then raise Exception.Create('PostThreadMessage ' + SysErrorMessage(GetLastError)); H[0] := Result.FEventArray[cteiClientAttached]; { Wait until thread has attached client socket to his own context. } WaitRes := WaitForMultipleObjects(2, @H, FALSE, Infinite); if WaitRes = WAIT_FAILED then raise Exception.Create('Wait client ThreadAttach ' + SysErrorMessage(GetLastError)) else if WaitRes = WAIT_OBJECT_0 + 1 then begin { ThreadAttach failed due to the thread terminated, let's try again } ClientAttachThread(Client); Exit; end; if Assigned(FOnClientAttached) then FOnClientAttached(Self, Client, Result); //LogDebug(IntToHex(Integer(Client), 8) + ' W att ID: ' + IntToHex(Result.ThreadID, 8)); end; Now, does the end of this function (FOnClientAttached()) run in the worker thread context? If not, what's the point in waiting with waitformultiplemessages? Isn't only the PostThreadMessage enough? Francois, could you enlight me? I am puzzled! Best 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
Re: [twsocket] WSocketTS
Fastream Technologies wrote: Now, does the end of this function (FOnClientAttached()) run in the worker thread context? No If not, what's the point in waiting with waitformultiplemessages? WaitForMultipleOBJECTS, not messages! In my opinion the listener thread needs to be blocked while the client has no window (until the client has the new window allocated in the worker thread). If you would post a message from the worker thread to the listener thread you would need to process messages in the listener thread in order to receive that message which would not block the listener thread. WaitForSingleObject would work also but is dangerous. - First object is an event handle signaled in the worker thread after the Client has called ThreadAttach. - Second object is the thread handle so if the thread thread terminates a new attempt is made to attach to another thread. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Isn't only the PostThreadMessage enough? Francois, could you enlight me? I am puzzled! Best 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
Re: [twsocket] WSocketTS
My puzzling slightly faded away, not completely. - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, March 22, 2006 6:16 PM Subject: Re: [twsocket] WSocketTS Fastream Technologies wrote: Now, does the end of this function (FOnClientAttached()) run in the worker thread context? No If not, what's the point in waiting with waitformultiplemessages? WaitForMultipleOBJECTS, not messages! In my opinion the listener thread needs to be blocked while the client has no window (until the client has the new window allocated in the worker thread). So do you think this design is not mature? If you would post a message from the worker thread to the listener thread you would need to process messages in the listener thread in order to receive that message which would not block the listener thread. Sure. WaitForSingleObject would work also but is dangerous. - First object is an event handle signaled in the worker thread after the Client has called ThreadAttach. - Second object is the thread handle so if the thread thread terminates a new attempt is made to attach to another thread I see. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Isn't only the PostThreadMessage enough? Francois, could you enlight me? I am puzzled! Best 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] WSocketTS
- Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, March 22, 2006 6:16 PM Subject: Re: [twsocket] WSocketTS Fastream Technologies wrote: Now, does the end of this function (FOnClientAttached()) run in the worker thread context? No If not, what's the point in waiting with waitformultiplemessages? WaitForMultipleOBJECTS, not messages! In my opinion the listener thread needs to be blocked while the client has no window (until the client has the new window allocated in the worker thread). I cannot do this without modifying Francois' existing code and breaking compatibility. What about detroying the window in constructor? BTW, isn't this what ThreadDetach does? If you would post a message from the worker thread to the listener thread you would need to process messages in the listener thread in order to receive that message which would not block the listener thread. WaitForSingleObject would work also but is dangerous. - First object is an event handle signaled in the worker thread after the Client has called ThreadAttach. - Second object is the thread handle so if the thread thread terminates a new attempt is made to attach to another thread. I tried this on the single connection per thread web server. Provided 700 requests/sec but failed after a min (LOCKED UP). Regards, SZ --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Isn't only the PostThreadMessage enough? Francois, could you enlight me? I am puzzled! Best 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
[twsocket] TWSocket Question
Hi I've been using a TWSocket component successfully in one of my home automation plug-in applications for several weeks now by using line mode with a #13 line end. This was really easy to set up and get working. Now I want to use the TWSocket in another plug-in application, however the TCP server this connects to sends me a set size data block, it always starts with a MPSEND but ends with a checksum value. Could you tell me the best way to deal with this? Phil Colley -- 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] TWSocket Question
Hello Philip, TCP server this connects to sends me a set size data block When you receive the size data block, then allocate memory for it, start concatenating data packets until you have received the exact size of the data. You have to save in a variable what is received, and what is left, to not receive more than the size. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Wednesday, March 22, 2006, 20:01, Philip Colley wrote: Hi I've been using a TWSocket component successfully in one of my home automation plug-in applications for several weeks now by using line mode with a #13 line end. This was really easy to set up and get working. Now I want to use the TWSocket in another plug-in application, however the TCP server this connects to sends me a set size data block, it always starts with a MPSEND but ends with a checksum value. Could you tell me the best way to deal with this? Phil Colley -- 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
[twsocket] ICS V6 Http Post problem
Already asked this in the borland newsgroup but was advised to asked it here again. I use v6 latest beta and if I do a asyncpost wiht some long parameters like Para1= para2=b para3=..(about 1600 chars) I will see something else with a sniffer Para1= para2=b para3=..( only a part of them) Para1= para2=b para3=..(again a part of them) Anyone with a hint how to solve this.? Frans -- 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
[twsocket] RPTD Q: Can Dup be called from worker thread?
Hello, We are writing a multi-threaded ICS HTTP Server component for ICS and need some help. You may begin by answering the question above. 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
Re: [twsocket] twsocket and proxy
[EMAIL PROTECTED] wrote: Hello Issue: I connect to internet thru a http proxy. What should I do in orger to make a link between a client and a server disposed on both sides of the proxy ? Currently this protocol is supported only in the THttpcli component. If you need it with TWSocket you would have to implement it by yourself. Not so difficult, since in HttpProt.pas you find all you need. Since a HTTP proxy is just another transparent proxy like Socks as well its use is not limited to the HTTP protocol. We already had a discussion about making it available in TWSocket, but nobody has done it so far. --- 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/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] RPTD Q: Can Dup be called from worker thread?
We are writing a multi-threaded ICS HTTP Server component for ICS and need some help. Can Dup be called from worker thread? Dup must be called from the thread which created the instance whatever this thread is. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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