[Pythonmac-SIG] Something not right with sockets...
Joel Bender
jjb5@cornell.edu
Wed, 27 Mar 2002 17:00:39 -0500
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')
In the socket documentation it says:
sendto(string[, flags], address)
Send data to the socket. The socket should not be connected to
a remote socket, since the destination socket is specified by
address. The optional flags argument has the same meaning as for
recv() above. Return the number of bytes sent. (The format of
address depends on the address family -- see above.)
I wouldn't expect the socket to need to be connected, since
SOCK_DGRAM is connectionless. Help!
Joel
--