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


Groups > comp.lang.python > #28085

Re: Is socket.recvfrom broken in ActiveState Python 3.2?

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Is socket.recvfrom broken in ActiveState Python 3.2?
Date 2012-08-29 22:22 -0400
Organization > Bestiaria Support Staff <
References <cf594a09-d5d2-4d92-912e-b283f4a2fa07@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3953.1346293361.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, 29 Aug 2012 17:38:28 -0700 (PDT), bbeacham@desanasystems.com
declaimed the following in gmane.comp.python.general:


> 
> However, the line 'data, senderAddr = sock.recvfrom(1024)' does not set the 'senderAddr' to anything.
>
	No -- if .recvfrom() didn't return a senderAddr you'd get an error
on the tuple unpack...

>>> d, sa = ("string",)
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ValueError: need more than 1 value to unpack
 
> In the code is this line:
> print('RECEIVED:', data, "SENDER:", str(senderAddr))
> 
> and this is the output.
> RECEIVED: Hello, world SENDER: None
>

>>> d, sa = ("string", None)
>>> str(sa) 
'None'
>>> 

	So senderAddr was either set to None; or is some object whose
__str__() method returns None... What does repr(senderAddr) give you?
 
> 
> Any ideas. Is this a bug in 'recvfrom'?

	Since it is documented that the behavior depends upon the underlying
OS socket implementation, you may need to look at those.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

Is socket.recvfrom broken in ActiveState Python 3.2? bbeacham@desanasystems.com - 2012-08-29 17:38 -0700
  Re: Is socket.recvfrom broken in ActiveState Python 3.2? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 22:22 -0400

csiph-web