Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

Reply
Thread Tools Display Modes

How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

 
 
Rajat
Guest
Posts: n/a

 
      05-27-2004, 06:28 AM
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.

Actually I am implementing Path MTUD, so for that I sent some udp
probs to destination host, now I want that the same socket at client
side must be able to receive both udp response and icmp error
messages(like host unreachable, port unreachable etc).

Another approach is that, we will use two sockets for both source and
destination, form source we will send udp probs(through udp socket)
while at destination host, after receiving that prob(through udp
socket), application will make an icmp packet and sent it back to the
source host (using ICMP socket). And here at source host, that message
and other icmp error messages will be received by icmp socket.

But this approch dosen't look efficient to me, what u people say? If
Any one has another approch plz let me know.

Eagerly waiting for some +ve pings.
 
Reply With Quote
 
 
 
 
Cameron Kerr
Guest
Posts: n/a

 
      05-27-2004, 08:00 AM
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!
 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      05-27-2004, 10:54 AM
Rajat wrote:

> 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 don't!

--

Fundamentalism is fundamentally wrong.

To reply to this message, replace everything to the left of "@" with
james.knott.
 
Reply With Quote
 
Andrew Keith
Guest
Posts: n/a

 
      05-29-2004, 06:19 PM
i think you cant ..

since UDP and ICMP are really different binds, i dont think you can
make a socket from both at the same time. (SOCKET_UDP, SOCKET_RAW)

Andrew


"Rajat" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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.
>
> Actually I am implementing Path MTUD, so for that I sent some udp
> probs to destination host, now I want that the same socket at client
> side must be able to receive both udp response and icmp error
> messages(like host unreachable, port unreachable etc).
>
> Another approach is that, we will use two sockets for both source and
> destination, form source we will send udp probs(through udp socket)
> while at destination host, after receiving that prob(through udp
> socket), application will make an icmp packet and sent it back to the
> source host (using ICMP socket). And here at source host, that message
> and other icmp error messages will be received by icmp socket.
>
> But this approch dosen't look efficient to me, what u people say? If
> Any one has another approch plz let me know.
>
> Eagerly waiting for some +ve pings.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Vista - Unable To Receive ICMP Destination Unreachable - P Tom Windows Networking 0 11-15-2008 05:06 PM
Receive DUP packet when ping chi.jojo@gmail.com Linux Networking 2 09-07-2006 04:48 AM
How big is socket receive buffer, and how to control it? C. J. Clegg Linux Networking 1 04-30-2006 08:58 AM
Problem of blocking ICMP packet while calculating Path MTU Rajat Linux Networking 2 05-08-2004 02:27 PM
Receive Packet Errors on Netgear MA401 David Wireless Internet 2 05-07-2004 01:51 PM



1 2 3 4 5 6 7 8 9 10 11