[Stackless] stackless socket, curiouser and curiouser

Paul Sijben sijben at eemvalley.com
Tue Feb 27 14:33:59 CET 2007


OK progress. After ditching any reference to threading.Thread and going
stackless all the way I now have a working stackless server.

However the client side seems to be the problem. connect on the UDP
socket I created blocks. See the code below:

    python2.5
    Python 2.5 Stackless 3.1b3 060516 (python-2.5:53777, Feb 14 2007,
    14:35:12)
    [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import stacklesssocket  as socket
    >>> s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    >>> s.setblocking(1)
    >>> s.connect(('192.168.0.145',42420))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/media/ORCA/src/stacklesssocket.py", line 135, in connect
        asyncore.dispatcher.connect(self, address)
      File "/usr/local/lib/python2.5/asyncore.py", line 314, in connect
        self.handle_connect()
      File "/media/ORCA/src/stacklesssocket.py", line 185, in handle_connect
        self.connectChannel.send(None)
    StopIteration: the main tasklet is sending without a receiver available.

No packet is sent btw. It does this with s.setblocking(1) and without. I
got the error above when I pressed ctrl-C.

This is the right way to set up a regular socket, but apparently not a
stacklessocket. Did I do something wrong or did I trigger a bug in
stacklesssocket?

Paul



Paul Sijben wrote:
> Do^h, I am feeling very stupid.  My loop and my problem with the test
> prog was the same issue. You can not do a recvfrom  on a non-blocking
> socket, and /unlike/ the regular socket, on asyncore sockets are
> non-blocking /by default! /Setting the stacklesssocket I made to
> blocking sorted that problem.
>
> Now I seem to be losing packets. wireshark tells me they are delivered
> to the machine, however my not blocking recvfrom does not return. But
> this is not in the test program only in the full one.
>
> So tomorrow I'll compare it the other way around.
>
> One question, what would cause stackless.run() to block?
>
> Paul
>
> Paul Sijben wrote:
>> working on it. for some strange reason the stacklesssocket tells me
>>     res = self.s.recvfrom(8192)
>> error: (11, 'Resource temporarily unavailable')
>>
>> yet I seem to have all the socket related stuff in the little script...
>>
>> I'll post the script when it works.
>>
>> Richard Tew wrote:
>>   
>>> On 2/26/07, Paul Sijben <sijben at eemvalley.com> wrote:
>>>     
>>>>  etc.... Well that tells me that the recvfrom throws me back down the
>>>> function stack. I am baffled as to why.
>>>>
>>>>  Can someone please explain this to me? (and of course what I should
>>>> to to
>>>> get the expected result)
>>>>       
>>> Hi Paul,
>>>
>>> Can you please provide a standalone script which when run reproduces
>>> this?
>>>
>>> Thanks,
>>> Richard.
>>>     
>>
>>   
>
> -- 
> Paul Sijben                    	tel: +31334566488
> Eemvalley Technology       	fax: +31334557523
> the Netherlands                	http://eemvalley.com    
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless

-- 
Paul Sijben                    	tel: +31334566488
Eemvalley Technology       	fax: +31334557523
the Netherlands                	http://eemvalley.com    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20070227/485b77a9/attachment.htm>
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless


More information about the Stackless mailing list