Article View: borland.public.cppbuilder.internet.socket
Article #4759Re: TIdTCPServer Command Handler
From: Ronny
Date: Wed, 29 Dec 2004 21:33
Date: Wed, 29 Dec 2004 21:33
34 lines
2392 bytes
2392 bytes
>You did not show your disconnect code. My guess is that your client class >is not derived from TObject, You are right, my class didn't derived from TObject. and you did not provide an OnDisconnect event >handler, so the TIdPeerThread tried to free the object assigned to the Data >property and thus produced an AV. No I didn't. It was my first question, I wanted to know if I had to create an OnDisconnect. But I didn't say all about my code so I appologize The object assigned to the Data property >is owned by the TIdPeerThread. When the thread is freed, the Data object is >freed as well. If the object derives from TObject then this works fine. But >if it is not derived from TObject then TIdPeerThread has no way of freeing >it safely so you must free it your manually via the OnDisconnect event. > So the onlye thing I needed to do is to add ": public TObject" to my class. >The alternative is to derive your client class from TIdPeerThread itself, >and set the server's ThreadClass property accordingly. Then you do not need >to use the Data property at all, and you can cast the Thread property of >each TIdCommand to your derived class directly. > > >Gambit > > thank you for your help.
Technical Details
Message-ID:
<41d32299$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!newsfeeder.concepts.nl!193.201.147.73.MISMATCH!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41d2f642$1@newsgroups.borland.com> <41d2ff3d$1@newsgroups.borland.com> <41d3044e$1@newsgroups.borland.com> <41d307a3$1@newsgroups.borland.com> <41d30da2@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,d17d5067aebc2759 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Ronny" <potapenko@check.com> Sender: "Ronny" <potapenko@check.com> Reply-To: "Ronny" <potapenko@check.com> Subject: Re: TIdTCPServer Command Handler Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 81.240.186.129 References: <41d2f642$1@newsgroups.borland.com> <41d2ff3d$1@newsgroups.borland.com> <41d3044e$1@newsgroups.borland.com> <41d307a3$1@newsgroups.borland.com> <41d30da2@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <41d32299$1@newsgroups.borland.com> Date: 29 Dec 2004 13:33:13 -0800 X-Trace: newsgroups.borland.com 1104355993 207.105.83.66 (29 Dec 2004 13:33:13 -0800) Lines: 36 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!newsfeeder.concepts.nl!193.201.147.73.MISMATCH!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail