I am going to jump in here and toot my own horn.  This responds to
Simon's comment, but is not addressed specifically to Simon.

If your reason for not using Twisted is in wanting to own your
main-loop, and your main-loop requirements include that it be
restartable, you might take a look at my 'PausingReactor'.

It is a Twisted reactor, derived from the default selectReactor, that
is written around a generator to allow exiting and restarting.

It has .release() and .resume() methods to get you out of, and back
into, the reactor.  So, even though, the Twisted reactor is strictly
*run-once*, you can treat it as though it were exitable and
restartable.  The reactor state is held in the generator while
execution continues outside the reactor.

There is a test script for it, but I admit I have not made extensive
use of it just yet.

The source code (it's brief) is cut-and-pasteable from the post:
http://pitchersduel.wordpress.com/2007/12/09/pausingreactorpy/

A description and usage example are here:
http://pitchersduel.wordpress.com/2007/12/07/pausing-reactor/

This does not address every objection to Twisted, for example, it is
still not a *run as fast as possible* mainloop, but it might be useful
to some of you.

David



On 2/21/08, Simon Wittber <[EMAIL PROTECTED]> wrote:
>
> On Feb 22, 12:50 am, Nathan <[EMAIL PROTECTED]> wrote:
> > I'm attempting to write a simple little real-time server-client game
> > where the server and client talk to each other over the network.
> >
> > My initial implementation uses the built-in socket module, but I can't
> > find a way to flush the socket!  Any suggestions for a simple way for
> > fast communications, or a way to make sockets work fast?  (right now,
> > the sockets seem to just wait about 2 seconds, and then transmit,
> > which is rather funny to watch, but not very playable).
>
> I'm not sure if you will find this easier than Twisted, but it works
> for me.
>
> http://exactlysimilar.org/downloads/socketome-0.05.tar.gz
>
> Some (poor) docs here:
>
> http://exactlysimilar.org/docs/socketome/
>
> I won't make any claims to ease of use or suitability, but I will say
> I wrote it because I don't like wrestling with Twisted, and I like to
> control my own run loop.
>
> I also agree with other posters comments re: UDP. It's hard work, and
> you'll most likely end up reimplementing TCP.
>
>
> >
>


-- 
[EMAIL PROTECTED]
Pitcher's Duel -> pitchersduel.python-hosting.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to