Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27479
| From | Guillaume Comte <guillaume.comte10@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | How to set the socket type and the protocol of a socket using create_connection? |
| Date | 2012-08-20 02:14 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <cbafe578-0a1a-4d0b-82a5-54c9f84fcd67@googlegroups.com> (permalink) |
Hello everyone,
I want to use socket.create_connection(...) to set a source address in a ping implementation in python.
But how can I then set the type and the protocol? Because, before, I did:
icmp = socket.getprotobyname("icmp")
my_socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp)
But now, I do:
src_addr = socket.gethostbyname(src_addr)
dest_addr = socket.gethostbyname(dest_addr)
my_socket = socket.create_connection(dest_addr, socket.getdefaulttimeout(), src_addr)
Is there something like my_socket.setproto()? I haven't found such a function in the documentation.
Thank you,
Guillaume
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-20 02:14 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-20 05:36 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Hans Mulder <hansmu@xs4all.nl> - 2012-08-20 15:38 +0200
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-20 08:04 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Dave Angel <d@davea.name> - 2012-08-20 13:27 -0400
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-21 10:00 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-21 10:00 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-21 15:28 -0400
Re: How to set the socket type and the protocol of a socket using create_connection? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-21 22:10 -0400
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 00:29 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 00:29 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Hans Mulder <hansmu@xs4all.nl> - 2012-08-22 11:03 +0200
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 02:21 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Chris Angelico <rosuav@gmail.com> - 2012-08-21 01:38 +1000
Re: How to set the socket type and the protocol of a socket using create_connection? Guillaume Comte <guillaume.comte10@gmail.com> - 2012-08-22 01:43 -0700
Re: How to set the socket type and the protocol of a socket using create_connection? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-22 15:18 -0400
Re: How to set the socket type and the protocol of a socket using create_connection? Grant Edwards <invalid@invalid.invalid> - 2012-08-23 13:53 +0000
csiph-web