Michael,

I was reviewing the TCPClient.py code.  In the runClient method you
have:

         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
yield 0.3
         self.sock = sock # We need this for shutdown later
         try:
            sock.setblocking(0); yield 0.6
            try:
               startConnect = time.time()
               while not self.safeConnect(sock,(self.host,
self.port)):

And in safeConnect you have:

         sock.connect(*sockArgsList); # Expect socket.error: (115,
'Operation now in progress')

In the python socket module docs I see:

    s.setblocking(0) is equivalent to s.settimeout(0)

and

    Note that the connect() operation is subject to the timeout
setting, and in general it is   recommended to call settimeout()
before calling connect().

So I get that you want the socket operations to be non-blocking.  And
non-blocking operations should fail if they can't complete rather than
block.  But the connect operation is using a timeout of zero because
of the blocking setting.  And it seems like the problem I'm having on
windows is that the connection attempt never times out.

So, would it be reasonable to:
1) setblocking(0) in runClient as it is today
2) In safeConnect, sock.settimeout(20)
3) sock.connect() as it is today
4) sock.settimeout(0) after the connection

It seems like this would allow you to have a timeout honored for the
connect operation without impacting non-blocking data operations post-
connect.

--Steve

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"kamaelia" group.
To post to this group, send email to kamaelia@googlegroups.com
To unsubscribe from this group, send email to 
kamaelia+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/kamaelia?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to