Article View: borland.public.cppbuilder.internet.socket
Article #479Re: TCP/IP Server block the access from one IP
From: Remy Lebeau (TeamB)
Date: Fri, 29 Feb 2008 18:17
Date: Fri, 29 Feb 2008 18:17
22 lines
1780 bytes
1780 bytes
"//---- Kelsie Z. Marshall ----//" <kelsie.z.marshall@gmail.com> wrote in
message news:47c79c6d@newsgroups.borland.com...
> I made a TCP/IP Server and i need to block the access from one IP
>
> Who can i do that ?
There is no way to block an IP from connecting to the server at all (unless
you are using an external firewall, that is). All you can do is disconnect
the client in the OnConnect event handler after it has been accepted by the
server, ie:
void __fastcall TForm1::IdTCPServer1Connect(TIdPeerThread *AThread)
{
AnsiString IP = AThread->Connection->Socket->Binding->PeerIP;
if( IP is not allowed )
AThread->Connection->Disconnect();
}
Gambit
Technical Details
Message-ID:
<47c84c35$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<47c79c6d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4fd13cd3e75ed5e2 X-Google-Attributes: gid11508e,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: <47c79c6d@newsgroups.borland.com> Subject: Re: TCP/IP Server block the access from one IP Date: Fri, 29 Feb 2008 10:17:43 -0800 Lines: 24 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 NNTP-Posting-Host: 207.178.157.90 Message-ID: <47c84c35$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1204309045 207.178.157.90 (29 Feb 2008 10:17:25 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail X-Original-Bytes: 1606