[Stackless] Reconnection problem with stacklesssocket

stackless.nst at internike.com stackless.nst at internike.com
Tue Aug 10 17:48:04 CEST 2010


Hi all,

I seem to have a problem while trying to reconnect to a (stackless) 
socket, after a first connection failure.

In fact, when a first connect fails, it seems that the second will 
always block forever (no matter if that one should fail or succeed).

Did I miss something ?

Nike.




# -*- coding: utf-8 -*-
import socket,time
import stackless,stacklesssocket,stackless_addins

def tst():

   address=('91.121.29.211',1234) #### Failing (rejected)
   print 'started'

   s=None
   print("Initiating connection to %s:%s" %(address[0],address[1]))

   s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   print('starting connect to %s:%s' %address)

   #s.setblocking(0)
   s.connect(address)
   print'connect finished!'
   s.close()

   stackless_addins.TaskletSleep(5)

   #address=('91.121.29.211',1234) #### Failing (rejected)
   address=('91.121.29.211',80) #### Working
   print('\n\nSecond attempt\n')

   s=None
   print("Initiating connection to %s:%s" %(address[0],address[1]))

   s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   print('starting connect to %s:%s' %address)

   s.setblocking(0)
   s.connect(address)
   print'connect finished!'
   s.close()



stacklesssocket.install()
stackless_addins.sleepingTasklets = []
stackless.tasklet(stackless_addins.ManageSleepingTasklets)()


stackless.tasklet(tst)()
stackless.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20100810/ce623780/attachment.html>


More information about the Stackless mailing list