Unix Programming - what's the difference between SOCK_PACKET and SOCK_RAW?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2004 > what's the difference between SOCK_PACKET and SOCK_RAW?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author what's the difference between SOCK_PACKET and SOCK_RAW?
fangweiwei

2004-02-15, 11:33 am

I only knows they both work on the Data Link Layer, and can directly
add Data Link layer Header on you application layer data, and you can
send it.SO what's the difference between them ?thanks.
Pascal Bourguignon

2004-02-15, 6:33 pm

fangweiwei@tom.com (fangweiwei) writes:

> I only knows they both work on the Data Link Layer, and can directly
> add Data Link layer Header on you application layer data, and you can
> send it.SO what's the difference between them ?thanks.


man 2 socket

SOCK_RAW
Provides raw network protocol access.

SOCK_PACKET
Obsolete and should not be used in new programs; see
packet(7).

man 7 packet

COMPATIBILITY
In Linux 2.0, the only way to get a packet socket was by calling
socket(PF_INET, SOCK_PACKET, protocol). This is still supported
but strongly deprecated. The main difference between the two
methods is that SOCK_PACKET uses the old struct sockaddr_pkt to
specify an interface, which doesn't provide physical layer inde_
pendence.



So I'd say the difference is about five years or more.

--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com