[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to spawn a server?
Mads Bondo Dydensborg:
>I am pretty sure, at least on linux, fork works with "copy on write"
>semantics. That is, stuff will be copied, but not before you actually
>write to it. So, read only stuff, like maps, textures, etc, will never be
>copied.
Ok, just what i needed to know.
Hope fork() will behave as smart with video and keyboard (but i think i have
to try this)...
Katie Lucas:
> > >Why not fork, exec the server executable (which will clear out all the
> > >open stuff) and then have the server open a port and have the clients
> > >connect to that?
Yes, it was an option.
However, fork() allows to use pipe() and socketpair(), that are very useful.
> > fork() isn't too portable. Not if we speak Windows.
> It's POSIX, most of the modern windows have POSIX support.
Mingw should support fork(); the problem is, again, with pipe() and
socketpair().
I need just a way to spawn a new, interconnected process from a process that
is already using lots of resources, and i to do it under linux.
Moving the fork() from `program initialization` to `when needed` should allow
porting the game to other systems preserving the main game structure...
Thanx to all!
Francesco Orsenigo, Xarvh Project