Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 74fbd0eb33bb08f719b79951bc4e329e > files > 38

xconq-7.5.0-1.20050612.5mdv2009.1.i586.rpm

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.39
     from ./hacking.texi on 12 June 2005 -->

<TITLE>Hacking Xconq - Networking</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="hacking_1.html">first</A>, <A HREF="hacking_27.html">previous</A>, <A HREF="hacking_29.html">next</A>, <A HREF="hacking_35.html">last</A> section, <A HREF="hacking_toc.html">table of contents</A>.
<HR>


<H1><A NAME="SEC30" HREF="hacking_toc.html#SEC30">Networking</A></H1>

<P>
The <I>Xconq</I> networking strategy is based on having each connected program
maintain a complete and accurate game state, and propagating user commands
from one of the programs to all others.  Thus all programs are equal; but
in order to serialize multiple simultaneous user commands, one of the
programs is a "first among equals" called the <I>master</I>.  If a player
interacting with a non-master clicks to move, then the command actually
just goes to the master and doesn't actually happen until the master
propagates the command to all programs.

</P>
<P>
The high-level protocol for all this is part of the <I>Xconq</I> kernel,
and includes buffering, checksum, and other features.
The OS interface code need only provide definitions for these functions:

</P>

<UL>

<LI>

<CODE>void open_remote_connection(char *methodname)</CODE>
establishes a connection to another program, using information supplied
in <CODE>methodname</CODE>.

<LI>

<CODE>void low_send(int id, char *buf)</CODE>
sends the contents of buf to the program whose remote id is id.

<LI>

<CODE>int low_receive(int *idp, char *buf, int maxchars, int timeout)</CODE>
waits for data from the given remote program, possibly timing out.
Returns TRUE if data was received.

<LI>

<CODE>void close_remote_connection(void)</CODE>
takes down and cleans up (which?) connection.

</UL>

<HR>
Go to the <A HREF="hacking_1.html">first</A>, <A HREF="hacking_27.html">previous</A>, <A HREF="hacking_29.html">next</A>, <A HREF="hacking_35.html">last</A> section, <A HREF="hacking_toc.html">table of contents</A>.
</BODY>
</HTML>