[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: creating socket


man socket says:

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

& man 7 packet says:

 Packet  sockets are used to receive or send raw packets at
       the device driver (OSI Layer 2) level. They allow the user
       to  implement protocol modules in user space on top of the
       physical layer.

for the socket() system call, the 3rd arg. is the protocol (udp/tcp/spx &
so on.) ETH_P_ALL is a catch all protocol type, indicating accept any
protocol type. Basically your program would first get the packets, b4 the
packets are transmitted to the next higher level (the appropriate handler
for that protocol).


On Tue, 19 Dec 2000, senthil devan wrote:

> Hi
> In this
> #define TO16(x)    ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
> sockid = socket(AF_INET, SOCK_PACKET, TO16(ETH_P_ALL))
> what does SOCK_PACKET mean. In went through W.R Stevens, but I am unable to
> find SOCK_PACKET type. Similarly I am not able to understand what is
> ETH_P_ALL and the necessity of the bit operations on it. Any help will be
> appreciated.
> Thanks in advance
> Devan
> ---------------------------------------------
> Find out more about this and other Linux India
> mailing lists at http://lists.linux-india.org/