[MUD-Dev] Question about copyovers.
fred at clift.org
fred at clift.org
Thu May 16 14:50:17 CEST 2002
>
> > Basically, you need to keep your vector of Sockets (the users who
> > are still connected, I have a big vector of sockets basically) and
> > completely startup a new copy of your mud, and somehow copy those
> > sockets over to your new running mud. Anyone know how to do this?
I dont know how to do it in java, but in C you have a couple of options.
The first is to have the existing server fork and exec making sure that
the descriptors are set to live through an exec) and pass info about what
descriptor is what (and auxilary info like where in the world they are
etc) via environment variables, disk-storage, or command-line options or
something.
Alternatively, at least in modern unixes (eg FreeBSD or Linux) one program
can pass open file descriptors to another over a unix domain socket. -
simply have the old program unbind the main tcp port of your server, bind
and listen a AF_LOCAL (or AF_UNIX) socket and then fork - the child will
then exec the new mud, which connect to the parent and the parent can pass
arbitrary data about game state, and pass open file descriptors to the new
instance - you can even pass 'secure' unix credentials over the socket too
so you can be guaranteed that the right person is sending you data, in the
case that you dont controll the box you run on. This approach is more
flexible, and if you read the stevens network programming book ( vol 1
chapter 14) you can basically just enter the code you find there and it
works. (actually, you can arbitrarily pass descriptors between processes
that are un-related - its quite fun when you get the hang of it...)
I presume that any java library you create in C would be based on this
code.
Fred
--
Fred Clift - fred at clift.org -- Remember: If brute
force doesn't work, you're just not using enough.
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list