View | Details | Raw Unified | Return to bug 28352
Collapse All | Expand All

(-)chapter.sgml (-9 / +12 lines)
Lines 56-62 Link Here
56
      your head sideways meant <emphasis>yes</emphasis>. Quickly, I
56
      your head sideways meant <emphasis>yes</emphasis>. Quickly, I
57
      started nodding my head up and down. The vendor noticed, took
57
      started nodding my head up and down. The vendor noticed, took
58
      his almonds, and walked away. To an uninformed observer, I did
58
      his almonds, and walked away. To an uninformed observer, I did
59
      not changed the body language: I continued using the language of
59
      not change the body language: I continued using the language of
60
      shaking and nodding my head. What changed was the
60
      shaking and nodding my head. What changed was the
61
      <emphasis>meaning</emphasis> of the body language. At first, the
61
      <emphasis>meaning</emphasis> of the body language. At first, the
62
      vendor and I interpreted the same language as having completely
62
      vendor and I interpreted the same language as having completely
Lines 335-341 Link Here
335
335
336
  </sect1>
336
  </sect1>
337
337
338
  <sect1 id="sockets-essetial-functions">
338
  <sect1 id="sockets-essential-functions">
339
    <title>Essential Socket Functions</title>
339
    <title>Essential Socket Functions</title>
340
340
341
    <para>While FreeBSD offers different functions to work with
341
    <para>While FreeBSD offers different functions to work with
Lines 377-383 Link Here
377
377
378
	  <para>Use <constant>PF_INET</constant> for
378
	  <para>Use <constant>PF_INET</constant> for
379
	    <acronym>UDP</acronym>, <acronym>TCP</acronym> and other
379
	    <acronym>UDP</acronym>, <acronym>TCP</acronym> and other
380
	    Internet protocols.</para>
380
	    Internet protocols (<acronym>IP</acronym>v4).</para>
381
381
382
	  <para>Five values are defined for the
382
	  <para>Five values are defined for the
383
	    <varname>type</varname> argument, again, in
383
	    <varname>type</varname> argument, again, in
Lines 385-395 Link Here
385
	    <quote><constant>SOCK_</constant></quote>.  The most
385
	    <quote><constant>SOCK_</constant></quote>.  The most
386
	    common one is <constant>SOCK_STREAM</constant>, which
386
	    common one is <constant>SOCK_STREAM</constant>, which
387
	    tells the system you are asking for a <emphasis>reliable
387
	    tells the system you are asking for a <emphasis>reliable
388
	    stream delivery service</emphasis>.</para>
388
	    stream delivery service</emphasis> (which is
389
	    <acronym>TCP</acronym> when used with
390
	    <constant>PF_INET</constant>).</para>
389
391
390
	  <para>If you asked for <constant>SOCK_DGRAM</constant>, you
392
	  <para>If you asked for <constant>SOCK_DGRAM</constant>, you
391
	    would be requesting a <emphasis>connectionless datagram
393
	    would be requesting a <emphasis>connectionless datagram
392
	    delivery service</emphasis>.</para>
394
	    delivery service</emphasis> (in our case,
395
	    <acronym>UDP</acronym>).</para>
393
396
394
	  <para>If you wanted to be in charge of the low-level
397
	  <para>If you wanted to be in charge of the low-level
395
	    protocols (such as <acronym>IP</acronym>), or even network
398
	    protocols (such as <acronym>IP</acronym>), or even network
Lines 710-716 Link Here
710
	    usually do not know whether it stores data <emphasis>most
713
	    usually do not know whether it stores data <emphasis>most
711
	    significant byte</emphasis> (<acronym>MSB</acronym>) or
714
	    significant byte</emphasis> (<acronym>MSB</acronym>) or
712
	    <emphasis>least significant byte</emphasis>
715
	    <emphasis>least significant byte</emphasis>
713
	    (<acronym>LSB</acronym>) byte first.</para>
716
	    (<acronym>LSB</acronym>) first.</para>
714
717
715
	  <para>You might be wondering, <emphasis><quote>So, will
718
	  <para>You might be wondering, <emphasis><quote>So, will
716
	    sockets not handle it for me?</quote></emphasis></para>
719
	    sockets not handle it for me?</quote></emphasis></para>
Lines 1271-1277 Link Here
1271
	    successfully, we are ready to become a
1274
	    successfully, we are ready to become a
1272
	    <emphasis>daemon</emphasis>: We use
1275
	    <emphasis>daemon</emphasis>: We use
1273
	    <function>fork</function> to create a child process. In
1276
	    <function>fork</function> to create a child process. In
1274
	    both, the parent and the child the <varname>s</varname>
1277
	    both, the parent and the child, the <varname>s</varname>
1275
	    variable is our socket. The parent process will not need
1278
	    variable is our socket. The parent process will not need
1276
	    it, so it calls <function>close</function>, then it
1279
	    it, so it calls <function>close</function>, then it
1277
	    returns <constant>0</constant> to inform its own parent it
1280
	    returns <constant>0</constant> to inform its own parent it
Lines 1395-1401 Link Here
1395
	  <para>Now, go ahead, save the above source code as
1398
	  <para>Now, go ahead, save the above source code as
1396
	    <filename>daytimed.c</filename> (it is customary to end
1399
	    <filename>daytimed.c</filename> (it is customary to end
1397
	    the names of daemons with the letter
1400
	    the names of daemons with the letter
1398
	    <constant>d</constant>. After you have compiled it, try
1401
	    <constant>d</constant>). After you have compiled it, try
1399
	    running it:</para>
1402
	    running it:</para>
1400
1403
1401
<screen>
1404
<screen>
Lines 1466-1472 Link Here
1466
1469
1467
whizkid          ttyp0   Jun 19 16:59   (216.127.220.143)
1470
whizkid          ttyp0   Jun 19 16:59   (216.127.220.143)
1468
xxx              ttyp1   Jun 19 16:06   (xx.xx.xx.xx)
1471
xxx              ttyp1   Jun 19 16:06   (xx.xx.xx.xx)
1469
&prompt.user; <userinput>telnet 216.127.220.107 13</userinput>
1472
&prompt.user; <userinput>telnet 216.127.220.143 13</userinput>
1470
1473
1471
Trying 216.127.220.143...
1474
Trying 216.127.220.143...
1472
Connected to r47.bfm.org.
1475
Connected to r47.bfm.org.

Return to bug 28352