🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3104

Re: Indy TCP "Wait for Reply"

#3104
From: Remy Lebeau (TeamB)
Date: Fri, 18 Nov 2005 01:44
42 lines
2502 bytes
"Darlington ADIBE" <bcb@triative.com> wrote in message
news:437d20f2@newsgroups.borland.com...

> I have up graded to indy9.

Which build, though?

> and now my server doesn't work again i get an
> access voilation error in the Execute Event

Your code should not be looping at all.  The OnExecute event handler is
already looped internally by Indy.  Just process a single command and then
exit the handler, ie:

    void __fastcall TForm1::tcpExecute(TIdPeerThread *AThread)
    {
        AnsiString request = AThread->Connection->ReadLn(LF,
IdTimeoutDefault, -1);
        request.Delete(1, 1);
        AnsiString cmd = Fetch(request, "#");
        if( cmd == "AUTHEN" )
            Authenticate(AThread, request);
        else if( cmd == "DISCONT" )
            AThread->Connection->DisconnectSocket();
    }

You might also consider using the CommandHandler collection instead of the
OnExecute event.  The CommandHandler collection provides much automation
when it comes to parsing and processing textual commands.

> I still don't see any property that allow me to change the
> default Line Terminatior

There is no property for that.  Simply specify the desired line terminator
when calling ReadLn().  That is what its first parameter is for:

    AnsiString request =
AThread->Connection->ReadLn('YourLineDelimiterHere', IdTimeoutDefault, -1);


Gambit
Technical Details
Message-ID: <437d3195$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!gail.ripco.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <437c328b@newsgroups.borland.com> <437cc79a$1@newsgroups.borland.com> <437cd28f@newsgroups.borland.com> <437cf568$1@newsgroups.borland.com> <437cfa81@newsgroups.borland.com> <437cfc7d$1@newsgroups.borland.com> <437d20f2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,187f889f070be6a7
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: <437c328b@newsgroups.borland.com> <437cc79a$1@newsgroups.borland.com> <437cd28f@newsgroups.borland.com> <437cf568$1@newsgroups.borland.com> <437cfa81@newsgroups.borland.com> <437cfc7d$1@newsgroups.borland.com> <437d20f2@newsgroups.borland.com>
Subject: Re: Indy TCP "Wait for Reply"
Date: Thu, 17 Nov 2005 17:44:10 -0800
Lines: 44
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: <437d3195$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1132278165 68.69.17.41 (17 Nov 2005 17:42:45 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!gail.ripco.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail