Sending a broadcast message using raw sockets

Rob Williscroft rtw at rtw.me.uk
Tue Jan 22 22:58:07 CET 2013


Peter Steele wrote in
news:96947c45-f16b-4e97-b055-edc1241ee4a1 at googlegroups.com in
comp.lang.python: 

> I just tried running you code, and the "sendto" call fails with
> "Network is unreachable". That's what I expected, based on other tests
> I've done. That's why I was asking about how to do raw sockets, since
> tools like dhclient use raw sockets to do what they do. It can clearly
> be duplicated in Python, I just need to find some code samples on how
> to construct a raw packet. 
> 

Try 
    	s = socket.socket( socket.AF_INET, socket.SOCK_RAW )

I tried this on windows and it needed admin privaleges to
run.

Rob.
-- 




More information about the Python-list mailing list