[Pythonmac-SIG] Something not right with sockets...

Steven Majewski sdm7g@virginia.edu
Wed, 27 Mar 2002 17:26:49 -0500 (EST)


On Wed, 27 Mar 2002, Joel Bender wrote:

> Python 2.2 (#124, Dec 22 2001, 17:36:16)  [CW PPC GUSI2 THREADS GC]
> Type "copyright", "credits" or "license" for more information.
> MacPython IDE 1.0.1
> >>>  from socket import socket, AF_INET, SOCK_DGRAM
> >>>  s = socket(AF_INET, SOCK_DGRAM)
> >>>  s.sendto('Bing!', ('128.235.245.112',43278) )
> Traceback (most recent call last):
>    File "<input>", line 1, in ?
> error: (57, 'Socket is not connected')

  ...

> I wouldn't expect the socket to need to be connected, since
> SOCK_DGRAM is connectionless.  Help!

Testing it out in mach-o (unix) python on OSX, using the UDP echo
service, I get the expected behaviour:
  To an address that actually running echo, sendto and recvfrom
	both work.
  To an address without an echo server, sendto works and recvfrom
	just hangs.
  No 'Socket is not connected' message in either case.

I haven't tried it to replicate it in MacPython yet, but it looks
like a bug.


-- Steve Majewski