Board index » delphi » Checking for open UDP socket with INDY components

Checking for open UDP socket with INDY components

Hi,

I've posted this in the kylix newsgroup, but had no replies, so I'm
trying my luck here:)

I need to check if a UDP port is open.  If I understand the RFC & docs
correctly, an ICMP error message will (should) be sent by the server
if the port is not.

Is there a way to check for this ICMP message from the server with the
Indy UDP client?

Any help/suggestions will be appreciated.

Thanks in advance.

Johann

 

Re:Checking for open UDP socket with INDY components


jc...@ats.sani.org (Johann du Preez) wrote in news:3bdfc9bd.178682261@forums.borland.com:

Quote
> I need to check if a UDP port is open.  If I understand the RFC & docs
> correctly, an ICMP error message will (should) be sent by the server
> if the port is not.

> Is there a way to check for this ICMP message from the server with the
> Indy UDP client?

Possibly in conjunction with the ICMP comnponent, but I dont get down to that level often so I cant
help you much more than this without reading the RFC myself.

--
Chad Z. Hower (Kudzu) - http://www.pbe.com/Kudzu/
Current Location: Melbourne, Australia
      "Programming is an art form that fights back"

Re:Checking for open UDP socket with INDY components


Hi Johann,

You are correct about the host behaviour. It should send an ICMP error
message however, for security reasons, firewalls will probably be configured
to block the reply (default) and similarly routers may be configured to
discard these messages.

Andrew

Quote
> Hi,

> I've posted this in the kylix newsgroup, but had no replies, so I'm
> trying my luck here:)

> I need to check if a UDP port is open.  If I understand the RFC & docs
> correctly, an ICMP error message will (should) be sent by the server
> if the port is not.

> Is there a way to check for this ICMP message from the server with the
> Indy UDP client?

> Any help/suggestions will be appreciated.

> Thanks in advance.

> Johann

Re:Checking for open UDP socket with INDY components


Andrew,

I am aware that I will have to deal with the situation where no reply
is received. IIRC, a 60 sec timeout or something.  My problem is how
to detect the ICMP reply when it is sent in response to an attempted
connection to a UDP port.

Cheers

On Thu, 1 Nov 2001 11:12:05 +0800, "Andrew Smallridge"

Quote
<asmal...@hotmail.com> wrote:
>Hi Johann,

>You are correct about the host behaviour. It should send an ICMP error
>message however, for security reasons, firewalls will probably be configured
>to block the reply (default) and similarly routers may be configured to
>discard these messages.

<SNIP>
Quote
>> I've posted this in the kylix newsgroup, but had no replies, so I'm
>> trying my luck here:)

>> I need to check if a UDP port is open.  If I understand the RFC & docs
>> correctly, an ICMP error message will (should) be sent by the server
>> if the port is not.

>> Is there a way to check for this ICMP message from the server with the
>> Indy UDP client?

Re:Checking for open UDP socket with INDY components


Chad,

Thanks.  I tried to use an ICMP component, but could for the life of
me not get it to detect the ICMP error sent in response to the
attempted UDP connection.

Thanks anyway :)

Johann

On 31 Oct 2001 05:21:33 -0800, "Kudzu - Team Indy" <chad...@pbe.com>
wrote:

Quote
>jc...@ats.sani.org (Johann du Preez) wrote in news:3bdfc9bd.178682261@forums.borland.com:
>> I need to check if a UDP port is open.  If I understand the RFC & docs
>> correctly, an ICMP error message will (should) be sent by the server
>> if the port is not.

>> Is there a way to check for this ICMP message from the server with the
>> Indy UDP client?

>Possibly in conjunction with the ICMP comnponent, but I dont get down to that level often so I cant
>help you much more than this without reading the RFC myself.

Re:Checking for open UDP socket with INDY components


Johann du Preez <jc...@ats.sani.org> wrote in message
news:3be1f006.254019911@forums.borland.com...

Quote
> Andrew,

> I am aware that I will have to deal with the situation where no reply
> is received. IIRC, a 60 sec timeout or something.  My problem is how
> to detect the ICMP reply when it is sent in response to an attempted
> connection to a UDP port.

Unfortunately I'm too new to Delphi/INDY to help. I would have "expected"
the INDY control to have returned an error to you but I don't know if these
controls have been implemented in such a way as to do this. I guess you will
have to crawl through the INDY source code to see if they do this.

Failing this you are going to have to develop you own socket code to
intercept ICMP messages.

Andrew

Quote

> Cheers

> On Thu, 1 Nov 2001 11:12:05 +0800, "Andrew Smallridge"
> <asmal...@hotmail.com> wrote:

> >Hi Johann,

> >You are correct about the host behaviour. It should send an ICMP error
> >message however, for security reasons, firewalls will probably be
configured
> >to block the reply (default) and similarly routers may be configured to
> >discard these messages.

> <SNIP>

> >> I've posted this in the kylix newsgroup, but had no replies, so I'm
> >> trying my luck here:)

> >> I need to check if a UDP port is open.  If I understand the RFC & docs
> >> correctly, an ICMP error message will (should) be sent by the server
> >> if the port is not.

> >> Is there a way to check for this ICMP message from the server with the
> >> Indy UDP client?

Re:Checking for open UDP socket with INDY components


"Andrew Smallridge" <asmal...@hotmail.com> wrote in news:3be26c28_1@dnews:

Quote
> Unfortunately I'm too new to Delphi/INDY to help. I would have "expected"
> the INDY control to have returned an error to you but I don't know if
> these controls have been implemented in such a way as to do this. I guess

Indy will return what the stack returns to it. Which does include connection refused.

But Indy itself will not look for an ICMP message, that is up to the stack to do, and its job I might
mention.

--
Chad Z. Hower (Kudzu) - http://www.pbe.com/Kudzu/
Current Location: St. Petersburg, Russia
      "Programming is an art form that fights back"

Other Threads