[DGD] Writing an external network daemon

Petter Nyström jimorie at gmail.com
Sun Jul 26 15:31:43 CEST 2009


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



More information about the DGD mailing list