SOCK_RAW with python socket library?

Jeff jam at quark.emich.edu
Mon Jun 19 19:58:09 EDT 2000


On Mon, Jun 19, 2000 at 07:08:03PM +0000, Tim Lavoie wrote:
> 
> Hello,
> 
> I've been tinkering with some socket programming lately, basically trying
> out ideas I get from browsing W. Richard Stevens' "UNIX Network
> Programming". Anyway, I'd like to play in Python too, so I'm using the
> socket library functions. When I try to use SOCK_RAW though, I get:
> 
>    socket.error: (93, 'Protocol not supported')
> 
> I understand the "operation not permitted" if I try it as a non-root user,
> but why this? Is SOCK_RAW not supported yet? The docs mention that it isn't
> generally useful, but it is quite specifically useful for say, ping.
> 
> 
>   Thanks,
>     Tim Lavoie
> 

greetings,

if all you really want is to implement 'ping' with python, this page:
http://the-tech.mit.edu/~jeremy/python/

has an implementation which I have used and I know works if run as root. in
fact, since it's kind of old (pre-1.5), it would be a good excercise to
reimplement using the 'struct' module (as the page suggests).

hope that helps...

regards,
J
-- 
|| visit gfd <http://quark.emich.edu/>
|| psa member -- <http://www.python.org/psa/> 




More information about the Python-list mailing list