[MUD-Dev] Question about copyovers.
lars at bearnip.com
Thu May 16 07:12:34 New Zealand Standard Time 2002
Anderson, David wrote on Wednesday, May 15 2002, 10:28:29:
> From: Tand'a-ur [mailto:tandaur at ix.netcom.com]
>> You write the descriptor numbers and other info like player names
>> into a file and then you run the mud again with some option that
>> tells the mud to look for that file and load up the players from
>> it. Then the old instance of the mud is ended.
>> This is roughly how they do it in diku derivs, you can dl the
>> code from it off the internet and see how they do it. Maybe that
>> will give you a better idea on how to do it than my rough
>> description of it.
> Yeah, I've seen the normal C copyover code that everyone has.
> Maybe I'm just a bit lost on the descriptor idea. What descriptor
> numbers are there I could get when people connect to my sockets,
> and how would those numbers in the files be useful to me? Is
> there a way to connect to those sockets that are connected to a
> different process if I run the mud again?
When people connect to your mud's socket, the operating system opens
new sockets for them, gives these sockets new file descriptor
numbers, and hands the file descriptor numbers to the program. For
the program then, these descriptors are the sockets.
When you now fork()/exec() a new program over a running one, the new
program inherits all external connections from the old one,
including all sockets. So by passing the list of socket file
descriptors to the new program, the new program has all it needs to
know to talk to the connected users.
Of course this only works if the program has direct access to the
Lars Duening; lars at bearnip.com
PGP Key: http://www.bearnip.com/lars/pgp-lars.asc
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev