⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 23.htm

📁 unix高级编程原吗
💻 HTM
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://apue.dhs.org"><font face="黑体"><big><big>123</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center">               ● UNIX网络编程                       (BM: clown)                </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p   align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="100" align="center" valign="top"><br><p align="center">[<a href="index.htm">回到开始</a>][<a href="16.htm">上一层</a>][<a href="24.htm">下一篇</a>]
<hr><p align="left"><small>发信人: fion (fion), 信区: UNP <br>

标  题: unix socket faq (2) <br>

发信站: UNIX编程 (2001年07月07日09:39:15 星期六), 站内信件 <br>

  <br>

 1.  General Information and Concepts <br>

  <br>

1.1.  About this FAQ <br>

  This FAQ is maintained by Vic Metcalfe (vic@acm.org), with lots of <br>

  assistance from Andrew Gierth (andrew@erlenstar.demon.co.uk).  I am <br>

  depending on the true wizards to fill in the details, and correct my <br>

  (no doubt) plentiful mistakes.  The code examples in this FAQ are <br>

  written to be easy to follow and understand.  It is up to the reader <br>

  to make them as efficient as required.  I started this faq because <br>

  after reading comp.unix.programmer for a short time, it became evident <br>

  that a FAQ for sockets was needed. <br>

  The FAQ is available at the following locations: <br>

     Usenet: (Posted on the 21st of each month) <br>

        news.answers, comp.answers, comp.unix.answers, <br>

        comp.unix.programmer <br>

     FTP: <br>

        ftp://rtfm.mit.edu/pub/usenet/news.answers/unix-faq/socket <br>

     WWW: <br>

        http://www.ibrado.com/sock-faq <br>



        http://kipper.york.ac.uk/~vic/sock-faq http://www.ntua.gr/sock- <br>

        faq <br>

  Please email me if you would like to correct or clarify an answer.  I <br>

  would also like to hear from you if you would like me to add a <br>

  question to the list.  I may not be able to answer it, but I can add <br>

  it in the hopes that someone else will submit an answer.  Every hour I <br>

  seem to be getting even busier, so if I am slow to respond to your <br>

  email, please be patient.  If more than a week passes you may want to <br>

  send me another one as I often put messages aside for later and then <br>

  forget about them.  I'll have to work on dealing with my mail better, <br>

  but until then feel free to pester me a little bit. <br>

  <br>

1.2.  Who is this FAQ for? <br>

  This FAQ is for C programmers in the Unix environment.  It is not <br>

  intended for WinSock programmers, or for Perl, Java, etc.  I have <br>

  nothing against Windows or Perl, but I had to limit the scope of the <br>

  FAQ for the first draft.  In the future, I would really like to <br>

  provide examples for Perl, Java, and maybe others.  For now though I <br>

  will concentrate on correctness and completeness for C. <br>

  This version of the FAQ will only cover sockets of the AF_INET family, <br>

  since this is their most common use.  Coverage of other types of <br>

  sockets may be added later. <br>



  <br>

1.3.  What are Sockets? <br>

  Sockets are just like "worm holes" in science fiction.  When things go <br>

  into one end, they (should) come out of the other.  Different kinds of <br>

  sockets have different properties.  Sockets are either connection- <br>

  oriented or connectionless.  Connection-oriented sockets allow for <br>

  data to flow back and forth as needed, while connectionless sockets <br>

  (also known as datagram sockets) allow only one message at a time to <br>

  be transmitted, without an open connection.  There are also different <br>

  socket families.  The two most common are AF_INET for internet <br>

  connections, and AF_UNIX for unix IPC (interprocess communication). <br>

  As stated earlier, this FAQ deals only with AF_INET sockets. <br>

  <br>

1.4.  How do Sockets Work? <br>

  The implementation is left up to the vendor of your particular unix, <br>

  but from the point of view of the programmer, connection-oriented <br>

  sockets work a lot like files, or pipes.  The most noticeable <br>

  difference, once you have your file descriptor is that read() or <br>

  write() calls may actually read or write fewer bytes than requested. <br>

  If this happens, then you will have to make a second call for the rest <br>

  of the data.  There are examples of this in the source code that <br>

  accompanies the faq. <br>



  <br>

1.5.  Where can I get source code for the book [book title]? <br>

  Here is a list of the places I know to get source code for network <br>

  programming books.  It is very short, so please mail me with any <br>

  others you know of. <br>

  Title: Unix Network Programming <br>

  Author: W. Richard Stevens (rstevens@noao.edu) <br>

  Publisher: Prentice Hall, Inc. <br>

  ISBN: 0-13-949876-1 <br>

  URL: http://www.noao.edu/~rstevens <br>

  Title: Power Programming with RPC <br>

  Author: John Bloomer <br>

  Publisher: O'Reilly & Associates, Inc. <br>

  ISBN: 0-937175-77-3 <br>

  URL: ftp://ftp.uu.net/published/oreilly/nutshell/rpc/rpc.tar.Z <br>

  Recommended by: Lokmanm Merican (lokmanm#pop4.jaring.my@199.1.1.88) <br>

  Title: UNIX PROGRAM DEVELOPMENT for IBM PC'S Including OSF/Motif <br>

  Author: Thomas Yager <br>

  Publisher: Addison Wesley, 1991 <br>

  ISBN: 0-201-57727-5 <br>

  <br>

1.6.  Where can I get more information? <br>



  I keep a copy of the resources I know of on my socks page on the web. <br>

  I don't remember where I got most of these items, but some day I'll <br>

  check out their sources, and provide ftp information here.  For now, <br>

  you can get them at http://www.ibrado.com/sock-faq. <br>

  There is a good TCP/IP FAQ maintained by George Neville-Neil <br>

  (gnn@wrs.com) which can be found at <br>

  http://www.visi.com/~khayes/tcpipfaq.html <br>

-- <br>

※ 来源:·UNIX编程 www.tiaozhan.com/unixbbs/·[FROM: 211.69.197.132] <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="16.htm">上一层</a>][<a href="24.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -