[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to spawn a server?
On Tue, Sep 10, 2002 at 02:17:46PM +0200, Francesco Orsenigo wrote:
> 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.
Surely since you're going to need to use TCPIP sockets for the other
clients to connect it makes sense to use them here?
> 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...
Er... why not launch the server from a shell script and then launch
the client?