Re: [twsocket] Multithreading with TFTPClient
Hello Joshua, This is example of a message pump, the loop finish when WM_QUIT is received, so you have to do to destroy the thread or at finish of program: procedure TDownloader.MessagePump; begin while GetMessate(Msg, 0, 0, 0 do begin case Msg.Message of // Here you can take actions for your own custom messages // if you need to else TranslateMessage(Msg); DispatchMessage(Msg); end; end; end; So in Execute method you have something to do like this: begin // create the components // assign the event handlers MessagePump; // destroy all end; --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, May 27, 2006, 18:13, [EMAIL PROTECTED] wrote: Hello, For if you use the component in a thread. Using it in a thread means: 1. create / destroy in the Execute method of the thread I create and destroy it in the execute method of the thread. 2. set Multithreading to True I set Multithreading to True, but I saw no changes. 3. use a message pump in the thread What is a message pump ? The machine where I read mail on cannot read .png files, so I cannot see it. Here are the same picturse as jpeg: 9 Threads: http://img97.imageshack.us/img97/7742/9threads4lc.jpg 10 Threads: http://img224.imageshack.us/img224/1348/10threads2uq.jpg Joshua - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, May 27, 2006 5:55 PM Subject: Re: [twsocket] Multithreading with TFTPClient Hello Joshua, I want to use the FTPClient in multithreading You dont need to multithreading with ICS components. Possible you need a thread if you have many simultanous connections and very high data transfer to not block the main thread. Also if you have thousands of connections then it can be wise to have a few separate thread. Here is an picture with my test-program with 9 threads: The machine where I read mail on cannot read .png files, so I cannot see it. By the way... what is the property Multithreading good for ? For if you use the component in a thread. Using it in a thread means: 1. create / destroy in the Execute method of the thread 2. set Multithreading to True 3. use a message pump in the thread If you do not have all 3 then you have a false thread and the components will run in main thread context. But again, you probably dont need a thread at all. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, May 27, 2006, 16:28, [EMAIL PROTECTED] wrote: Hello, I want to use the FTPClient in multithreading and programed a test-program. But as I started the threads I noticed that the maximum theads are 9. If I used only one thread more nothing works. Here is an picture with my test-program with 9 threads: http://img74.imageshack.us/img74/6498/9threads3tp.png As you can see except for one thread everything works. And here is a picture with ten threads: http://img103.imageshack.us/img103/2748/10threads6ux.png As you can see only a few threads works and the others got an error like this: Logfile: 220 Speak friend, and enter USER * 331 FTP login okay, send password. PASS * 230 User logged in, proceed. TYPE I 200 Using BINARY mode to transfer data. SIZE EK040905.exe 213 7929582 PORT 192,168,2,32,4,181 200 PORT command successful. REST 1638400 350 Restarting at 1638400 RETR EK040905.exe 150 Opening BINARY mode data connection (6291182 bytes). 451 Transfer incomplete. Closing data connection. ! RETR/LIST/NLST Failed QUIT 221 Goodbye. The same problem appears when there are other FTP-programs running like smartFTP or FlashFXP. I hope you have understand my problem. By the way... what is the property Multithreading good for ? Sincerely yours -- 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] Multithreading with TFTPClient
From the _same_ FTP server or from another FTP server ? It never minds from which FTP-Server the FTP-Cients downloading. But if other programs downloading files, my test-program becomes defective. We have to find out the source of the problem. It could be the server or it could be something in your internet connection. Or both... Try to launch several FTP transferts from the _same_ FTP server, using on program per download (for example with Windows command line FTP client). See how many simultaneous download you ca do (I repeat: from the same FTP server). Repeat the same test as above but using a different FTP server for each program instance. The result of those test will tell you if it is the server you connect to which limit the number of concurrent connections or something else. [...]and use a proper message pump, that is one with GetMessage and _no_ PeakMessage. I have found the event OnMessagePump but what is it good for ? I don't know what you mean. There are a lot of messages about message pump and the likes in this mailing list. First do a little search in the archive (Link at the support page at my website), read the articles and then is still needed, ask for more questions. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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] how to use tpop3cli with ssl
But I cannot estimate the time necessary to achieve my goal since I don't know Delphi but only C++ Builder. If you know C++, you can easily program in Delphi :-) Just replace { and } with begin and else, = by :=, == by =, by and, || by or, - by ., by @, return(X) by Result := X; Exit;, in all variable and function argument swap variable name and datatype, include by uses, struct by record, #define by const and you have translated your 95% of C++/ to Delphi. There are also some syntaxe differences, but not too much. OK, some elaborated preprocessor macros and C++ Templates are more difficult to translate as is multiple inheritance... -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Alain TAUBER [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, May 27, 2006 9:58 PM Subject: Re: [twsocket] how to use tpop3cli with ssl Thanks a lot, François. But I cannot estimate the time necessary to achieve my goal since I don't know Delphi but only C++ Builder. Nevertheless, if I can help somebody to make the new component POP3 supporting SSL, I shall try. -- Alain Francois PIETTE a écrit : You need ICS-SSL to do that (Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html). And the POP3 component is still on the to-do list. Not a big deal, but yet to be done. NNTP and SMTP are done and is useful to understand how to add SSL to a high level component (much the same as in a simple application using TCP). / Has anybody already used TPop3Cli to access POP3S (995) // servers and how is it possible ?/ -- 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] ICS: Sending file through THttpServer, code exemple
Looking to the mailling list, I've seen some people trying to send file in the WebServ demo of ICS. I've played around a bit with it trying to get it working, and ended up with a very simple way to do it : Thanks for your example. + 'Connection: ' + ClientCnx.FRequestConnection + '\r\n' + '\r\n\r\n'; With the correct flag and a valid file Stream associated to ClientCnx.FDocStream, but I ended up with random behaviours (unknown size by browsers, no action in firefox, opera wouldn't see when the download is over, etc ...) I guess i did it bad. You have bad end of line marker. '\r\n' are just C/C++ end of line. Translated to Delphi, it is #13#10. And you have one too much: end of header is an empty line. You have two ! You code becomes: + 'Connection: ' + ClientCnx.FRequestConnection + #13#10 + + #13#10; // Only one CRLF to end the header. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Lepidosteus [EMAIL PROTECTED] To: twsocket@elists.org Sent: Sunday, May 28, 2006 3:09 AM Subject: [twsocket] ICS: Sending file through THttpServer, code exemple Hello, Looking to the mailling list, I've seen some people trying to send file in the WebServ demo of ICS. I've played around a bit with it trying to get it working, and ended up with a very simple way to do it : In HttpServer1GetDocument add the case you want : ... else if CompareText(ClientCnx.Path, '/myfile.mp3') = 0 then CreateVirtualDocument_File(Sender, ClientCnx, Flags); ... Create the appropriate procedure CreateVirtualDocument_File Then, put this code in it : procedure TWebServForm.CreateVirtualDocument_File( Sender: TObject; ClientCnx : TMyHttpConnection; var Flags : THttpGetFlag); begin Flags := hgSendDoc; ClientCnx.FDocument:='J:\myfile.mp3'; end; And you're done ! (i've seen numerous exemple of people trying to do that and no working exemple, so i thought this would be a good thing to post it) Lepidosteus PS: I first tried to build up my own header using header := ClientCnx.FVersion + ' Status ''200 OK''\r\n' + 'Content-Length: ' + inttostr(ClientCnx.FDocStream.size) +'\r\n' + 'Content-type: '+DocumentToContentType(ClientCnx.FDocument)+'\r\n' + 'Content-Disposition: attachment; filename=' + ClientCnx.FDocument +'\r\n' + 'Connection: ' + ClientCnx.FRequestConnection + '\r\n' + '\r\n\r\n'; With the correct flag and a valid file Stream associated to ClientCnx.FDocStream, but I ended up with random behaviours (unknown size by browsers, no action in firefox, opera wouldn't see when the download is over, etc ...) I guess i did it bad. -- 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] Threaded Socketspy Demo
I am inquiring about the socket spy program and how difficult it would be to thread it? I examined thrdsrv1 example in ics examles and want to know where to begin. If anyone can point me in the right direction please. The current program works great but threading is required because the traffic is fairly heavy even for asynchronous sockets so I feel it needs threaded so that my main gui thread does not slow to a crawl. Thanks, Ryan S. -- 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] HTTP Digest auth code not applied to V6??
Hello Francois, I see you did not apply the digest auth to HTTP of v6. Is there a particular reason? 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