How to set the socket type and the protocol of a socket using create_connection?

Hans Mulder hansmu at xs4all.nl
Mon Aug 20 09:38:14 EDT 2012


On 20/08/12 14:36:58, Guillaume Comte wrote:
> In fact, socket.create_connection is for TCP only so I cannot use it for a ping implementation.

Why are you trying to reimplement ping?

All OS'es I am aware of come with a working ping implementation.


> Does anyone have an idea about how to be able to set a source address for ICMP messages?

Did you try not setting it?

The default is probably your own IP address, which is the only
sensible value anyway.  Or are you trying to cause confusion
by sending ICMP packets with a forged source address?

-- HansM



More information about the Python-list mailing list