<html><body>On 01:48 am, rampeters@gmail.com wrote:<br />>I am looking for some guidance on how to poll a resource on another<br />>computer using twisted.  Poll a remote resource, if a task is<br />>available, I need to perform it on the twisted machine, not on the<br />>remote resource machine.  Can anyone tell me how I can do this.<br />>Twisted event loops only listens for incoming.  I need to go out and<br />>check the resource and begin processing.<br /><br />This question is extremely open-ended.  I could think of maybe 50 ways to implement this functionality as specified, and I'm not sure exactly what you're thinking.<br /><br />Twisted does listen for incoming *events*, but I think what you mean is that it listens only for incoming *connections*.  If what you mean is simply "how do I connect to another host as a client", see this document:<br /><br />    http://twistedmatrix.com/projects/core/documentation/howto/clients.html<br /><br />If what you mean is "how do I do something, such as check a remote resource, periodically", you might want to use Twisted's LoopingCall object:<br /><br />    http://twistedmatrix.com/documents/current/api/twisted.internet.task.LoopingCall.html<br /><br />If what you mean is "how do I stop my program and wait for something to happen", you don't need to.  Simply ask the remote computer about the resource you are polling (by establishing a client connection and writing some bytes to it, for example), and then wait for the reactor to tell you that it has responded.  If you want to establish a timeout, set up a timed call using reactor.callLater, and cancel it if the response arrives first.<br /><br /></body></html>