Rajat <(E-Mail Removed)> wrote:
> Dear All,
>
> Can we configure one socket to receive two different protocols packet.
> Like how can we made a UDP socket to receive udp as well as icmp
> messages.
You need to use two sockets and select() on them for readability. The
ICMP socket will need to be a RAW IP socket, IIRC, and will require root
priviledge.
Get yourself a copy of Unix Network Programming (3rd version is
the latest). I have the 2nd version, which I used for teaching network
programming last year. Its a truly great book that everyone will refer
you to in newsgroups.
You might also want to have a look to see what error (if any) you get on
your UDP packet when fragmentation is needed, but Don't Fragment is set.
You may need to use the recvmsg functions for this, plus maybe set some
socket options to turn on Don't Fragment.
Actually, I think UNP covers how to do Path MTUD in one of the
exercises, IIRC (it's at work, I can't currently check.)
--
Cameron Kerr
(E-Mail Removed) :
http://nzgeeks.org/cameron/
Empowered by Perl!