Article View: borland.public.cppbuilder.internet.socket
Article #1979Re: Would Indy's TIdTCPServer have any problem with connections I never read from?
From: Remy Lebeau (TeamB)
Date: Thu, 31 Aug 2006 21:08
Date: Thu, 31 Aug 2006 21:08
51 lines
3118 bytes
3118 bytes
"Lesley Anne" <mspfila-ng@yahoo.com> wrote in message news:44f73d33$1@newsgroups.borland.com... > I'd like to use that method, but it only seems to take care of the > TIdPeerThread cases. Since OnListenException takes place > in the context of a TIdListenerThread instead, would it not work > there? There is nothing you can do about manipulating those threads. You will have to use the TIdSync approach for that event instead. TIdSync has a secondary constructor that does have a thread parameter. That constructor creates a thread internal to the IdSync unit and is then used that for the call to Synchronize(). Otherwise, re-design your code to not require Synchronized methods in the first place. For instance, if all you are trying to do is log the error messages, then write your logging code to be thread-safe, such as protecting the log file with a critical section, and don't access the UI directly at all. If you must use the GUI in your logging, then have the logging code post strings to a thread-safe queue that the main thread can then display perioically. > In your TIdSync descendant, I kind of got lost on what ended up > happening to the string. It gets stored into the FStr member of the class, then TIdSync::Sychronize() calls TThread::Synchronize(DoSynchronize) internally, and then TMySync::DoSynchronize() uses FStr as needed. At some point it needs to reach my form where I can display it. That is what the overriden DoSynchronize() method is for. > So would that go with something like: Yes. > Basically, will Sync->Synchronize() take care of whatever it needs > to do to make sure the threads actually are in synch, then call my > DoSynchronize() function in a context where it's safe to do so? Yes. > Part of my problem in understanding this is that I don't really > understand quite what Synchronize() does in the first place. See above. Gambit
Technical Details
Message-ID:
<44f7509c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<44f480ff@newsgroups.borland.com> <44f49d01$1@newsgroups.borland.com> <44f5c67a$1@newsgroups.borland.com> <44f5e682$1@newsgroups.borland.com> <44f5ef4f@newsgroups.borland.com> <44f6068c$1@newsgroups.borland.com> <44f70595$1@newsgroups.borland.com> <44f71c6c$1@newsgroups.borland.com> <44f73d33$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,c51ec25c5d4e68e1 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <44f480ff@newsgroups.borland.com> <44f49d01$1@newsgroups.borland.com> <44f5c67a$1@newsgroups.borland.com> <44f5e682$1@newsgroups.borland.com> <44f5ef4f@newsgroups.borland.com> <44f6068c$1@newsgroups.borland.com> <44f70595$1@newsgroups.borland.com> <44f71c6c$1@newsgroups.borland.com> <44f73d33$1@newsgroups.borland.com> Subject: Re: Would Indy's TIdTCPServer have any problem with connections I never read from? Date: Thu, 31 Aug 2006 14:08:45 -0700 Lines: 53 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <44f7509c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157058716 68.69.17.41 (31 Aug 2006 14:11:56 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail