[Twisted-Python] Problem with using mktap

Eric Mangold teratorn at world-net.net
Tue Nov 16 14:16:36 EST 2004


Roland Hedberg wrote:
> 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:

First, is there a good reason to use mktap for your application?

>
> 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"

As a side note this is just bad.  Don't use a bare except:
unless you absolutely have to, and please document it if you do.

-Eric




More information about the Twisted-Python mailing list