Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27591

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

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: How to set the socket type and the protocol of a socket using create_connection?
Date 2012-08-21 15:28 -0400
Organization > Bestiaria Support Staff <
References (1 earlier) <4edc5ccb-9121-47b0-8ad4-2bf106735532@googlegroups.com> <50323dc7$0$6841$e4fe514c@news2.news.xs4all.nl> <c8381655-3c9a-4100-81af-bcd3f07414f0@googlegroups.com> <mailman.3568.1345483663.4697.python-list@python.org> <7e4fbbae-a70f-42fc-82c9-a03f1a118136@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3617.1345577311.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, 21 Aug 2012 10:00:28 -0700 (PDT), Guillaume Comte
<guillaume.comte10@gmail.com> declaimed the following in
gmane.comp.python.general:

> Unfortunatly, my_socket.bind((src_addr, 1)) doesn't work. I get the error message: "socket.error: [Errno 49] Can't assign requested address"...

	Port #1 is in the range of OS privileged ports; you may need root
privileges to bind to it.

http://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html

{Note: one link I hit indicates that M$ Windows does not have this
restriction; and 

>>> s = socket.socket(socket.AF_INET)
>>> s.bind(("", 1))
>>> 

seems to confirm that... OTOH: specifying an invalid IP address
regardless of port produces

>>> s.bind(("192.168.1.10", 1))
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "<string>", line 1, in bind
error: (10049, "Can't assign requested address")
>>> 

whereas using the DHCP assigned address gave

>>> s.close()
>>> s = socket.socket(socket.AF_INET)
>>> s.bind(("192.168.2.101", 1))
>>> 
}
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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