[Twisted-Python] cannot get simple example to run

Jean-Paul Calderone exarkun at divmod.com
Mon Apr 28 15:33:30 EDT 2008


On Mon, 28 Apr 2008 15:23:47 -0400, klok000 at gmail.com wrote:
>Hello everyone.  Try as I might I cannot get a very simple example to run.
>I basically want a server that accepts connections, and periodically issues
>messages to all clients.  The docs for twisted.word says things are in flux
>so I would rather avoid that and just use a LineReceiver.  However right now
>I can't get anything to work.
>
>I start the server and it seems to be happy to sit around and accept
>connections.  However when I run the client it quits (without saying why)
>and no connection is made.  Any help would be very much appreciated.  Here's
>the code, log messages below that.  Thanks!
>
> [snip]

>##################################################
># client.py
>##################################################
> [snip]
>sys.stderr.write('Client connecting...\n')
>
>f = GreeterClientFactory()
>reactor.connectTCP("localhost", 9010, f)
>
>sys.stderr.write('Client done\n')
>

After reactor.connectTCP, you may want to call reactor.run. :)

>##################################################
># client.log
>##################################################
>2008/04/28 12:38 -0400 [-] Log opened.
>2008/04/28 12:38 -0400 [-] Client connecting...
>2008/04/28 12:38 -0400 [-] Starting factory <__main__.GreeterClientFactory
>instance at 0x8354d8c>
>2008/04/28 12:38 -0400 [-] Client startedConnecting
>2008/04/28 12:38 -0400 [-] Client done

Jean-Paul




More information about the Twisted-Python mailing list