cvs commit: de-docproj/books/developers-handbook/sockets chapter.sgml

From: Johann Kois <jkois(at)doc.bsdgroup.de>
Date: Tue, 10 Feb 2009 11:20:38 GMT

jkois 2009-02-10 11:20:38 UTC

  FreeBSD German Documentation Repository

  Modified files:
    books/developers-handbook/sockets chapter.sgml
  Log:
  Das noch nicht ersetzte Kapitel 7 - Sockets durch einen Hinweis auf das englische Original ersetzt. Damit steht einem MFde prinzipiell
  nichts mehr im Wege.
  
  Revision Changes Path
  1.4 +6 -1780 de-docproj/books/developers-handbook/sockets/chapter.sgml
  
  Index: chapter.sgml
  ===================================================================
  RCS file: /home/cvs/de-docproj/books/developers-handbook/sockets/chapter.sgml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -I$FreeBSDde.*$ -r1.3 -r1.4
  --- chapter.sgml 31 Aug 2007 06:13:10 -0000 1.3
  +++ chapter.sgml 10 Feb 2009 11:20:38 -0000 1.4
  @@ -8,1786 +8,12 @@
   -->
   
   <chapter id="sockets">
  - <chapterinfo>
  - <authorgroup>
  - <author>
  - <firstname>G. Adam</firstname>
  - <surname>Stanislav</surname>
  - <contrib>Contributed by </contrib>
  - </author>
  - </authorgroup>
  - </chapterinfo>
  -
     <title>Sockets</title>
   
  - <sect1 id="sockets-synopsis">
  - <title>Synopsis</title>
  -
  - <para><acronym>BSD</acronym> sockets take interprocess
  - communications to a new level. It is no longer necessary for the
  - communicating processes to run on the same machine. They still
  - <emphasis>can</emphasis>, but they do not have to.</para>
  -
  - <para>Not only do these processes not have to run on the same
  - machine, they do not have to run under the same operating
  - system. Thanks to <acronym>BSD</acronym> sockets, your FreeBSD
  - software can smoothly cooperate with a program running on a
  - &macintosh;, another one running on a &sun; workstation, yet another
  - one running under &windows; 2000, all connected with an
  - Ethernet-based local area network.</para>
  -
  - <para>But your software can equally well cooperate with processes
  - running in another building, or on another continent, inside a
  - submarine, or a space shuttle.</para>
  -
  - <para>It can also cooperate with processes that are not part of a
  - computer (at least not in the strict sense of the word), but of
  - such devices as printers, digital cameras, medical equipment.
  - Just about anything capable of digital communications.</para>
  -
  - </sect1>
  -
  - <sect1 id="sockets-diversity">
  - <title>Networking and Diversity</title>
  -
  - <para>We have already hinted on the <emphasis>diversity</emphasis>
  - of networking. Many different systems have to talk to each
  - other. And they have to speak the same language. They also have
  - to <emphasis>understand</emphasis> the same language the same
  - way.</para>
  -
  - <para>People often think that <emphasis>body language</emphasis>
  - is universal. But it is not. Back in my early teens, my father
  - took me to Bulgaria. We were sitting at a table in a park in
  - Sofia, when a vendor approached us trying to sell us some
  - roasted almonds.</para>
  -
  - <para>I had not learned much Bulgarian by then, so, instead of
  - saying no, I shook my head from side to side, the
  - <quote>universal</quote> body language for
  - <emphasis>no</emphasis>. The vendor quickly started serving us
  - some almonds.</para>
  -
  - <para>I then remembered I had been told that in Bulgaria shaking
  - your head sideways meant <emphasis>yes</emphasis>. Quickly, I
  - started nodding my head up and down. The vendor noticed, took
  - his almonds, and walked away. To an uninformed observer, I did
  - not change the body language: I continued using the language of
  - shaking and nodding my head. What changed was the
  - <emphasis>meaning</emphasis> of the body language. At first, the
  - vendor and I interpreted the same language as having completely
  - different meaning. I had to adjust my own interpretation of that
  - language so the vendor would understand.</para>
  -
  - <para>It is the same with computers: The same symbols may have
  - different, even outright opposite meaning. Therefore, for
  - two computers to understand each other, they must not only
  - agree on the same <emphasis>language</emphasis>, but on the
  - same <emphasis>interpretation</emphasis> of the language.
  - </para>
  - </sect1>
  -
  - <sect1 id="sockets-protocols">
  - <title>Protocols</title>
  -
  - <para>While various programming languages tend to have complex
  - syntax and use a number of multi-letter reserved words (which
  - makes them easy for the human programmer to understand), the
  - languages of data communications tend to be very terse. Instead
  - of multi-byte words, they often use individual
  - <emphasis>bits</emphasis>. There is a very convincing reason
  - for it: While data travels <emphasis>inside</emphasis> your
  - computer at speeds approaching the speed of light, it often
  - travels considerably slower between two computers.</para>
  -
  - <para>Because the languages used in data communications are so
  - terse, we usually refer to them as
  - <emphasis>protocols</emphasis> rather than languages.</para>
  -
  - <para>As data travels from one computer to another, it always uses
  - more than one protocol. These protocols are
  - <emphasis>layered</emphasis>. The data can be compared to the
  - inside of an onion: You have to peel off several layers of
  - <quote>skin</quote> to get to the data. This is best
  - illustrated with a picture:</para>
  -
  - <mediaobject>
  - <imageobject>
  - <imagedata fileref="sockets/layers">
  - </imageobject>
  -
  - <textobject>
  - <literallayout class="monospaced">+----------------+
  -| Ethernet |
  -|+--------------+|
  -|| IP ||
  -||+------------+||
  -||| TCP |||
  -|||+----------+|||
  -|||| HTTP ||||
  -||||+--------+||||
  -||||| PNG |||||
  -|||||+------+|||||
  -|||||| Data ||||||
  -|||||+------+|||||
  -||||+--------+||||
  -|||+----------+|||
  -||+------------+||
  -|+--------------+|
  -+----------------+</literallayout>
  - </textobject>
  -
  - <textobject>
  - <phrase>Protocol Layers</phrase>
  - </textobject>
  - </mediaobject>
  -
  - <para>In this example, we are trying to get an image from a web
  - page we are connected to via an Ethernet.</para>
  -
  - <para>The image consists of raw data, which is simply a sequence
  - of <acronym>RGB</acronym> values that our software can process,
  - i.e., convert into an image and display on our monitor.</para>
  -
  - <para>Alas, our software has no way of knowing how the raw data is
  - organized: Is it a sequence of <acronym>RGB</acronym> values, or
  - a sequence of grayscale intensities, or perhaps of
  - <acronym>CMYK</acronym> encoded colors? Is the data represented
  - by 8-bit quanta, or are they 16 bits in size, or perhaps 4 bits?
  - How many rows and columns does the image consist of? Should
  - certain pixels be transparent?</para>
  -
  - <para>I think you get the picture...</para>
  -
  - <para>To inform our software how to handle the raw data, it is
  - encoded as a <acronym>PNG</acronym> file. It could be a
  - <acronym>GIF</acronym>, or a <acronym>JPEG</acronym>, but it is
  - a <acronym>PNG</acronym>.</para>
  -
  - <para>And <acronym>PNG</acronym> is a protocol.</para>
  -
  - <para>At this point, I can hear some of you yelling,
  - <emphasis><quote>No, it is not! It is a file
  - format!</quote></emphasis></para>
  -
  - <para>Well, of course it is a file format. But from the
  - perspective of data communications, a file format is a protocol:
  - The file structure is a <emphasis>language</emphasis>, a terse
  - one at that, communicating to our <emphasis>process</emphasis>
  - how the data is organized. Ergo, it is a
  - <emphasis>protocol</emphasis>.</para>
  -
  - <para>Alas, if all we received was the <acronym>PNG</acronym>
  - file, our software would be facing a serious problem: How is it
  - supposed to know the data is representing an image, as opposed
  - to some text, or perhaps a sound, or what not? Secondly, how is
  - it supposed to know the image is in the <acronym>PNG</acronym>
  - format as opposed to <acronym>GIF</acronym>, or
  - <acronym>JPEG</acronym>, or some other image format?</para>
  -
  - <para>To obtain that information, we are using another protocol:
  - <acronym>HTTP</acronym>. This protocol can tell us exactly that
  - the data represents an image, and that it uses the
  - <acronym>PNG</acronym> protocol. It can also tell us some other
  - things, but let us stay focused on protocol layers here.
  - </para>
  -
  - <para>So, now we have some data wrapped in the <acronym>PNG</acronym>
  - protocol, wrapped in the <acronym>HTTP</acronym> protocol.
  - How did we get it from the server?</para>
  -

----------------------------------------------
Diff block truncated. (Max lines = 200)
----------------------------------------------

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-cvs-doc" in the body of the message
Received on Tue 10 Feb 2009 - 12:20:53 CET

search this site