[Twisted-Python] Problem with using mktap

Roland Hedberg roland.hedberg at adm.umu.se
Tue Nov 16 13:41:26 EST 2004


Hi!

I'm implementing a server, who on one sida should have a connection to 
a unix domain socket and on the other hand listen on a UDP socket.

On the unix domain socket this server works as a client.

First without mktap. This works:

if __name__ == "__main__":
	port = 6666
	sserv = "/tmp/uds"
	name = "router"

	f = spocpFactory( )
	router = RudsProt( f, name, 1 )

	try:
		reactor.connectUNIX( sserv, f )
		reactor.listenUDP( port, router )
		reactor.run()
	except:
		print "Server missing"


What should this look like using mktap ?

Tried a simple rewrite:

def makeService( config ):
	port = int(config["port"])
	routeServer = config["spocp"]
	nodename = config["name"]

	application = service.Application('UDSRouter')
	f = spocpFactory()
	reactor.connectUNIX( routeServer, f )
	router = RudsProt( f,nodename)
	udpServer = internet.UDPServer( port, router )
	udpServer.setServiceParent(application)
	return udpServer

Didn't work.
Well, actually mktap doesn't complain and I get a tap file. But when I 
run it using twistd spocpFactory doesn't seem to be initialized, ever.


-- Roland





More information about the Twisted-Python mailing list