Hello again I couldn't get any answer to my question and I think I couldn't point my problem clearly.
https://github.com/naimon/Jobbar/blob/master/src/lib/server.py On the line #130 I need to check if the socket is still connected. That worker variable is a copy of self.transport actually. I have found it's an instance of twisted.internet.tcp.Server I also found getHandle method to reach the actual socket but I couldn't find any method to check its availability. Help please. Thank you. On Sun, Dec 5, 2010 at 9:18 PM, Umut Aydin <devnetw...@gmail.com> wrote: > Thank you for your response. > > I have another question. In my job server I collect worker connections > into a key/value structure by their categories which means jobs and I > send them some messages when a client connection made a request > suitable with one of worker connections. The problem is that worker > connection may not be available at the moment. I am looking for a > method (like isConnected in Apache Mina) to check if remote socket is > available. > > By the way may be I store wrong object. Maybe I should store something > else instead of storing self.transport Any advice will be appreciated! > > Hope I could explain myself clearly. > > Thank you. > > On Sun, Dec 5, 2010 at 4:43 PM, Godson Gera <godso...@gmail.com> wrote: >> >> On Sun, Dec 5, 2010 at 4:07 PM, Umut Aydin <devnetw...@gmail.com> wrote: >>> >>> Hello everybody. Hope you have a good weekend. >>> >>> I'm trying to port my distributed job server project to twisted but I >>> have a few questions. >>> >>> I just tested twisted with protocol.Protocol socket handler class and >>> it seems like that it creates a new instance for each connection. I >>> want to put those connection's ip addresses into an array. Where >>> should I do that exactly? >>> >>> How can I get ip address and port information out of >>> self.transport.getPeer()? >> >> Each created protocol comes with a refrence to factory that is creating >> them, which is a right place of doing all the inter protocol operations . >> You can access it via factory attribute of protocol. So, in a typical >> twisted program you can refer to the factory by doing self.factory in the >> created protocol. You can define an array called peers in factory and access >> it like self.factory.peers. >> >> Check out buildProtocol() method of twisted factories to customize protcol >> instantiation. >> >> Yes, transport.getPeers() gives you the remote end host and port. >> >> -- >> Thanks & Regards, >> Godson Gera >> Twisted Python India >> >> >> _______________________________________________ >> Twisted-Python mailing list >> Twisted-Python@twistedmatrix.com >> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python >> >> > > > > -- > Best Regards, > > Umut AYDIN > Email: m...@umut.mobi > > Skype: umut-aydin > > Blog: http://umut.mobi > -- Best Regards, Umut AYDIN Email: m...@umut.mobi Skype: umut-aydin Blog: http://umut.mobi _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python