🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: IdFTPServer server and firewall

#305
From: Remy Lebeau (TeamB)
Date: Wed, 09 Apr 2008 18:09
33 lines
2413 bytes
"roladdon" <roladdon@PutMyServerHere.ca> wrote in message 
news:47fcf224$1@newsgroups.borland.com...

> Memo1->Lines->Add("PASV command");

That code is not thread-safe.  Any event handler that provides access to a 
TIdContext object is fired in the context of the thread that owns that 
object.  You cannot safely access UI component from outside the context of 
the main thread.  You need to use the TIdSync class for that, or any other 
synchronization technique of your choosing.

> if 
> (ASender->Binding()->PeerIP.SubString(0,ASender->Binding()->PeerIP.LastDelimiter("."))

0 is an invalid string index.  VCL Strings are 1-indexed, not 0-indexed.

> AnsiString __fastcall TForm1::GetPublicIP(AnsiString pDomainName)
> {
> IdDNSResolver1->Resolve(pDomainName);

There is an easier way to do that - use an HTTP query instead, such as to 
http://iplookup.flashfxp.com, to get the exact IP that your server machine 
is accessible from publically.  You don't need to perform your own DNS 
lookups, ie:

    AnsiString __fastcall TForm1::GetPublicIP()
    {
        return IdHTTP->Get("http://iplookup.flashfxp.com");
    }


Gambit 
Technical Details
Message-ID: <47fd067c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.arglkargh.de!feeder.erje.net!news.isoc.lu!newsgroups.borland.com!not-for-mail
References: <47fbd697@newsgroups.borland.com> <47fbdfde$1@newsgroups.borland.com> <47fc0c8a@newsgroups.borland.com> <47fc0dc4$1@newsgroups.borland.com> <47fc1653@newsgroups.borland.com> <47fc471d$1@newsgroups.borland.com> <47fc6112$1@newsgroups.borland.com> <47fcd43b$1@newsgroups.borland.com> <47fcefc5@newsgroups.borland.com> <47fcf224$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3bf5299e11a8ee87
X-Google-Attributes: gid11508e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <47fbd697@newsgroups.borland.com> <47fbdfde$1@newsgroups.borland.com> <47fc0c8a@newsgroups.borland.com> <47fc0dc4$1@newsgroups.borland.com> <47fc1653@newsgroups.borland.com> <47fc471d$1@newsgroups.borland.com> <47fc6112$1@newsgroups.borland.com> <47fcd43b$1@newsgroups.borland.com> <47fcefc5@newsgroups.borland.com> <47fcf224$1@newsgroups.borland.com>
Subject: Re: IdFTPServer server and firewall
Date: Wed, 9 Apr 2008 11:09:57 -0700
Lines: 35
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <47fd067c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1207764604 207.178.157.90 (9 Apr 2008 11:10:04 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.arglkargh.de!feeder.erje.net!news.isoc.lu!newsgroups.borland.com!not-for-mail