[Tutor] Raw Sockets

Alan Gauld alan.gauld@blueyonder.co.uk
Sun Aug 3 12:58:02 EDT 2003


>     Raw sockets are much misunderstod i guess.. python documentation
does
> not provide much on this...though it just about says that its
implemented.
> but similar calls to ones in unix donot work

Most of the BSD socket interface works pretty much as is but only on
a limited(ie the most common) set of protocols.

> Specifically what i need to know is that how do i recv data from a
raw
> socket...

There is a tutorial on the Python site(by Gordon McMillan?) on using
sockets which shows how to do UDP and TCP/IP. I don't think ICMP is
supported?

> My reqmt is to monitor all traffic coming from an physical interface
like a
> lan card in python..

That would require monitoring ethernet packets which are below the
socket level interface. Probably you need to look at even lower
level libraries like ioctl etc. I confess never to having programmed
at ethernet level so can't help much there.

It will presumably be OS dependant but you mentioned Unix earlier
so I'll assume you are on a *nix system.

Alan G.





More information about the Tutor mailing list