Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > df754e4e6f7f5fc8ab9d6ed8559f3e3d > files > 61

bacula-docs-5.0.3-19.fc16.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2008 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Higher Level Conventions</TITLE>
<META NAME="description" CONTENT="Higher Level Conventions">
<META NAME="keywords" CONTENT="developers">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="developers.css">

<LINK REL="previous" HREF="Becoming_Server.html">
<LINK REL="up" HREF="TCP_IP_Network_Protocol.html">
<LINK REL="next" HREF="Smart_Memory_Allocation.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1795"
  HREF="Smart_Memory_Allocation.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1789"
  HREF="TCP_IP_Network_Protocol.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1785"
  HREF="Becoming_Server.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1791"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1793"
  HREF="GNU_Free_Documentation_Lice.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1796"
  HREF="Smart_Memory_Allocation.html">Smart Memory Allocation</A>
<B> Up:</B> <A NAME="tex2html1790"
  HREF="TCP_IP_Network_Protocol.html">TCP/IP Network Protocol</A>
<B> Previous:</B> <A NAME="tex2html1786"
  HREF="Becoming_Server.html">Becoming a Server</A>
 &nbsp; <B>  <A NAME="tex2html1792"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1794"
  HREF="GNU_Free_Documentation_Lice.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0018120000000000000000"></A>
<A NAME="6290"></A>
<A NAME="6291"></A>
<BR>
Higher Level Conventions
</H1>

<P>
Within Bacula, we have established the convention that any time a single
record is passed, it is sent with bnet_send() and read with bnet_recv().
Thus the normal exchange between the server (S) and the client (C) are: 

<P>
<PRE>
S: wait for connection            C: attempt connection
S: accept connection              C: bnet_send() send request
S: bnet_recv() wait for request
S: act on request
S: bnet_send() send ack            C: bnet_recv() wait for ack
</PRE>
<P>
Thus a single command is sent, acted upon by the server, and then
acknowledged. 

<P>
In certain cases, such as the transfer of the data for a file, all the
information or data cannot be sent in a single packet. In this case, the
convention is that the client will send a command to the server, who knows
that more than one packet will be returned. In this case, the server will
enter a loop: 

<P>
<PRE>
while ((n=bnet_recv(bsock)) &gt; 0) {
   act on request
}
if (n &lt; 0)
   error
</PRE>
<P>
The client will perform the following: 

<P>
<PRE>
bnet_send(bsock);
bnet_send(bsock);
...
bnet_sig(bsock, BNET_EOD);
</PRE>
<P>
Thus the client will send multiple packets and signal to the server when all
the packets have been sent by sending a zero length record. 

<P>

<IMG
 WIDTH="443" HEIGHT="67" ALIGN="BOTTOM" BORDER="0"
 SRC="img5.png"
 ALT="\includegraphics{smartall.eps}"> 

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1795"
  HREF="Smart_Memory_Allocation.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1789"
  HREF="TCP_IP_Network_Protocol.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1785"
  HREF="Becoming_Server.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1791"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1793"
  HREF="GNU_Free_Documentation_Lice.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1796"
  HREF="Smart_Memory_Allocation.html">Smart Memory Allocation</A>
<B> Up:</B> <A NAME="tex2html1790"
  HREF="TCP_IP_Network_Protocol.html">TCP/IP Network Protocol</A>
<B> Previous:</B> <A NAME="tex2html1786"
  HREF="Becoming_Server.html">Becoming a Server</A>
 &nbsp; <B>  <A NAME="tex2html1792"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1794"
  HREF="GNU_Free_Documentation_Lice.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>

2012-01-24
</ADDRESS>
</BODY>
</HTML>