Question about Sockets

  • Thread starter Thread starter Bernd
  • Start date Start date
B

Bernd

hi,

is it possible to use a Socket (proto_udp) and recieve icmp messages ?
what i want to do is, send a datagram to a remote host/port and check if
the host replies with port_unreachable (i think icmp type 3).
is this possible with a udp Socket and the RecieveFrom() method ?.
another approach would be (at least thats what i think) to use a raw
socket with proto_udp.
is this a wrong way to go ?

thanks
 
Bernd said:
hi,

is it possible to use a Socket (proto_udp) and recieve icmp messages ?
what i want to do is, send a datagram to a remote host/port and check if
the host replies with port_unreachable (i think icmp type 3).
is this possible with a udp Socket and the RecieveFrom() method ?.
another approach would be (at least thats what i think) to use a raw
socket with proto_udp.
is this a wrong way to go ?

thanks

Hi,

hhmmm, I think ICMP messages are not sent through UDP. So, I'm not sure
but I think its not possible to do that with a UDP Socket.

Yours sincerely

Andy
 
Andy said:
Hi,

hhmmm, I think ICMP messages are not sent through UDP. So, I'm not sure
but I think its not possible to do that with a UDP Socket.

Yours sincerely

Andy


ok, thanks for your answer. and yes you are right, icmp is not sent
through udp.
would it be possible to work with 2 sockets ? lets say i create an udp
socket, send a dgram and recieve the reply with a raw socket
proto_type_icmp ?

thanks
 
Bernd said:
ok, thanks for your answer. and yes you are right, icmp is not sent
through udp.
would it be possible to work with 2 sockets ? lets say i create an udp
socket, send a dgram and recieve the reply with a raw socket
proto_type_icmp ?

thanks

Hi,

ok, I've looked in W. Richard Stevens book "TCP/IP Volume 1" and found
out, that you can use the UDP Socket to receive the ICMP reply of your
sent datagram. In the ICMP message the IP-Header and the first 8 bytes
of the IP-Data are transmitted. And Stevens wrote: the ICMP module can
assiciate with this information an UDP Port and respectivly a process
with the ICMP reply.

Yours sincerely

Andy
 
Back
Top