[DGD] Writing an external network daemon

Noah Gibbs noah_gibbs at yahoo.com
Sun Jul 26 16:38:56 CEST 2009


  I'd agree with Felix -- don't have DGD receive the connection specially or from a weird protocol and then pass it to receive_message (though that's not a terrible method).  Instead, use an honest to got new connection between the two of them, on the appropriate port, so that your daemon doesn't have to do any translating beyond repeated copying.

  For the copying, your daemon should do as little buffering as is practical.  Just copy it straight through and let DGD buffer it.  You may want to do some small level of buffering in case of network hiccups, but those will be *very* rare, and pretty much only occur when you're passing huge buffers through.  For a MUD, chances are good it'll never happen at all.

--- On Sun, 7/26/09, Petter Nyström <jimorie at gmail.com> wrote:

> From: Petter Nyström <jimorie at gmail.com>
> Subject: [DGD] Writing an external network daemon
> To: "All about Dworkin's Game Driver" <dgd at dworkin.nl>
> Date: Sunday, July 26, 2009, 6:31 AM
> The recent thread
> "networking/beginner comments" re-sparked my wish to
> write an external network daemon for my MUD. The concept of
> an
> external network daemon has been discussed earlier on this
> list as an
> alternative solution to the network package. I do not have
> a real need
> for outgoing network connections in my MUD at this point,
> and if I did
> I'd probably be using the network package anyway. So this
> is just an
> exercise for myself.
> 
> Anyway, to get to my question. I have most of the stuff
> operational
> now: objects can inherit an API that allows them to request
> an
> outgoing connection and is hooked up by the external daemon
> that let
> them send data back and forth. But my problem is this: how
> should I
> best control the flow of data that it passed to
> receive_message()? My
> alternatives have been:
> 
>  * Let the external daemon pass on character by character
> to
> receive_message() and let the LPC layer deal with buffering
> and so
> forth.
> 
>  * Let the external daemon know something about the
> protocol that is
> to be used, so that i can do buffering by newline,
> EOF-mark, whatever;
> and then send appropriate chunks of data to
> receive_message().
> 
>  * Let the external daemon buffer for as long as there is
> data to be
> read from the socket, and send the buffer to
> receive_message() when
> there is no more data to read. But this seems like it could
> get into
> an undefined behaviour pretty easily if there is a busy
> connection?
> 
> I feel that I'm lacking some knowledge in the networking
> field here.
> Please advice! =)
> 
> For example, how does the networking package work?
> 
> Thanks,
> 
> Jimorie
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
> 


      



More information about the DGD mailing list