python - transport is NoneType when using UNIXClientEndpoint of Twisted -


i'm trying implement simple client twisted using datagram , named pipe.

i define protocol follow:

class consoleprotocol(protocol.datagramprotocol):      def __init__(self, machine, console_path):         self.console_path = console_path         self.transport = none      def datagramreceived(self, datagram, addr):         self.logger.debug("datagramreceived()")         # blah, doing stuff !      def sendhalt(self):         self.logger.debug("sending message fifo %s", self.console_path)         self.transport.write("ahaha", self.console_path) 

and connect unix client endpoint:

console_endpoint = endpoints.unixclientendpoint(reactor, console_path) console_protocol = consoleprotocol() endpoints.connectprotocol(self.console_endpoint, self.console_protocol) 

but during execution of method sendhalt(), transport argument nonetype. correct way use unix client twisted ?

endpoints aren't datagram protocols. need use reactor.listenunixdatagram(console_path, console_protocol). sure not confuse unix sockets , named pipes: different, incompatible things. twisted doesn't include support communicating on named pipes.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -