[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Looks to me like python grabs an outgoing port number via unrandom means Python does not grab an outgoing port number, its lets the OS choose one (via connect()). The only thing to watch out for would be whether you let many connections open (perhaps there's

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
Changes by James Hutchison : -- components: +Windows ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
James Hutchison added the comment: Looks to me like python grabs an outgoing port number via unrandom means and if it happens to map to a port taken by a service that demands exclusive access, then it returns the WSAEACCESS error instead of WSAEADDRINUSE. Because this is a fairly new "feature"

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Brian Curtin
Changes by Brian Curtin : -- nosy: -brian.curtin ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.p

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
Changes by James Hutchison : -- status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Martin v . Löwis
Martin v. Löwis added the comment: The Python API maps nearly 1:1 to the winsock API. So the Python code literally translates to the equivalent C code (with *very* minor deviations e.g. involving the conversion of string addresses in numeric addresses). Please leave the issue closed unless you

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
James Hutchison added the comment: I can connect to all of the IPs for my server without issue. Found this: Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is b

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: By the way, please check the return value of getaddrinfo() for your SMTP server: >>> socket.getaddrinfo("www.gmail.com", 25, 0, socket.SOCK_STREAM) [(2, 1, 6, '', ('74.125.230.213', 25)), (2, 1, 6, '', ('74.125.230.214', 25)), (10, 1, 6, '', ('2a00:1450:4007:80

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
James Hutchison added the comment: The firewall is disabled for my machine. So the options are: 1. Port was in-use: possible except that is normally a different error 2. Port was firewalled: firewall was disabled 3. Port mis-use: not likely because this wouldn't be random 4. Port was in restrict

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Oh, a random Google search brought the following comment from the chromium source code (it seems): “connect fails with WSAEACCES when Windows Firewall blocks the connection”. This sounds like a likelier explanation than the previous one. -- __

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: According to the MSDN doc for connect(): WSAEACCES: An attempt to connect a datagram socket to broadcast address failed because setsockopt option SO_BROADCAST is not enabled. However, this implies that `getaddrinfo(host, port, 0, SOCK_STREAM)` (in socket.crea

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
James Hutchison added the comment: It's from the example. http://docs.python.org/library/socket.html#example -- ___ Python tracker ___ __

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: > s.bind(('',50007)) How did you find out 50007? Is it just a random number you chose? -- nosy: +brian.curtin, pitrou, tim.golden ___ Python tracker __

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
James Hutchison added the comment: That makes no sense. Why does: s = socket.socket() s.bind(('',50007)) s.listen(1); s.close(); fix the issue then? Re-opening, this issue should be understood because having such an operation randomly fail is unacceptable for a production system. How does pyt

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Martin v . Löwis
Martin v. Löwis added the comment: It's very easy to see why it survives a reboot. If there is a collision with some other process, that process restarts, recreating the collision. Things may depend on timing, so it may happen on some reboots and not on others (e.g. if the colliding process ha

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
James Hutchison added the comment: This is the traceback I was getting where it was just a script that simply made an SMTP connection then closed it. This fails before it attempts to connect to the server. Traceback (most recent call last): File "C:\tmp\manysmtptest.py", line 8, in main

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread Martin v . Löwis
Martin v. Löwis added the comment: As this is an error reported by Windows, it *very* unlikely is an issue with Python. Instead, it's a reaction that Windows produced to some sequence of events. My guess is that another process had the address in use, apparently, Windows then reports WSAEACCE

[issue15779] socket error [Errno 10013] when creating SMTP object

2012-08-24 Thread James Hutchison
New submission from James Hutchison: Windows 7 64-bit, Python 3.2.3 This is a very odd issue and I haven't figured out what caused it. I have a python script that runs continuously. When it receives a request to do a task, it creates a new thread (not a new process), does the task, then sends