More detailed output is here: http://pastebin.com/UnYMaLKe
This is happening when I run the test suite on OSX. This does not occur on Linux (Ubuntu 12.04). I've narrowed down the issue to the use of socket.connect followed by a socket.sendto: according to the docs, you shouldn't do this.
I made a small script to reproduce the problem, and have confirmed the differing behaviors on OSX and Linux.
import socket
receiver = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sender = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
addr = ('127.0.0.1', 27000)
receiver.bind(addr)
sender.connect(addr)
num_bytes = sender.send(b'foo')
print('Received: %s' % receiver.recv(num_bytes))
num_bytes = sender.sendto(b'bar', addr)
print('Received: %s' % receiver.recv(num_bytes))
On Linux, the output is:
Received: b'foo'
Received: b'bar'
On OSX, the output is:
Received: foo
Traceback (most recent call last):
File "socktest.py", line 13, in
num_bytes = sender.sendto(b'bar', addr)
socket.error: [Errno 56] Socket is already connected
I've tested this script with multiple versions of Python, and the behavior is the same: the Linux socket implementation is more forgiving.
More detailed output is here: http://pastebin.com/UnYMaLKe
This is happening when I run the test suite on OSX. This does not occur on Linux (Ubuntu 12.04). I've narrowed down the issue to the use of
socket.connectfollowed by asocket.sendto: according to the docs, you shouldn't do this.I made a small script to reproduce the problem, and have confirmed the differing behaviors on OSX and Linux.
On Linux, the output is:
On OSX, the output is:
Received: foo Traceback (most recent call last): File "socktest.py", line 13, in num_bytes = sender.sendto(b'bar', addr) socket.error: [Errno 56] Socket is already connectedI've tested this script with multiple versions of Python, and the behavior is the same: the Linux socket implementation is more forgiving.