raw socket exapmle?

Grant Edwards ge at nowhere.none
Fri Jul 14 13:51:45 EDT 2000


In article <rFGb5.1091$6E.150413 at ptah.visi.com>, Grant Edwards wrote:

>After looking at the source code for the socket module in 1.52
>and 1.6a2, it doesn't look like either RAW or PACKET sockets
>are supported.
>
>Darn.  Maybe I'll work on that.  It should be pretty trivial to
>add for Linux.

I've decided to add support for Linux "packet" sockets to the
socket module.  I presume most other Unices support some sort
of packet interface to Ethernet devices (libpcap is probably
the source for definitive examples).  I've no clue about Win32
or MacOS.

Example usage will be something like:

  s = socket(AF_PACKET,SOCK_RAW[,0x11fe])
  s.bind(('eth0'[,0x11fe]))

Where 'eth0' is the name of the network interface to which the
socket should be bound, and 0x11fe is the Ethernet protocol
number of interest.

Comments and suggestions will be accepted until I get back from
the pop machine...

-- 
Grant Edwards                   grante             Yow!  BEEP-BEEP!! I'm a
                                  at               '49 STUDEBAKER!!
                               visi.com            



More information about the Python-list mailing list