<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>网络编程 on kamuszhou&#39;s blog</title>
    <link>https://ykyi.net/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/</link>
    <description>Recent content in 网络编程 on kamuszhou&#39;s blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Mon, 26 Dec 2011 16:59:47 +0000</lastBuildDate>
    <atom:link href="https://ykyi.net/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Unix网络编程 第13章 Daemon Processes and the inetd Superserver 笔记</title>
      <link>https://ykyi.net/?p=356/</link>
      <pubDate>Mon, 26 Dec 2011 16:59:47 +0000</pubDate>
      <guid>https://ykyi.net/?p=356/</guid>
      <description>&lt;p&gt;# The syslogd daemon runs in an infinite loop that calls select, waiting for any one of its three descriptors to be readable. it reads the log message and does what the configuration file says to do with that message. If the daemon receives the SIGHUP signal, it rereads its configuration file. So, what are the three descriptors that the select system call is waiting for ?  1. A unix domain socket is created and bound to the pathname /var/run/log (/dev/log on some systems). 2. A udp socket is created and bound to port 514(the syslog service). 3. The pathname /devklog is opened. Any error messages from within the kernel appears as input on this device. Newer implementation disable the creation of the UDP socket, unless specified by the administrator, as allowing anyone to send UDP datagrams to this port opens the system up to denial-of-service attacks, where some one could fill up the filesystem.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Unix网络编程 第11章 Name and Address Conversions 笔记</title>
      <link>https://ykyi.net/?p=344/</link>
      <pubDate>Mon, 26 Dec 2011 12:48:53 +0000</pubDate>
      <guid>https://ykyi.net/?p=344/</guid>
      <description>&lt;p&gt;# gethostbyname 和 gethostbyaddr 用来在 IPv4 地址和 hostname 之间转换. getservbyport 和 getservbyname 则是与服务相关。gethostbyname出错时不设errno而是设h_errno，并有hstrerror()函数。&lt;/p&gt;
&lt;p&gt;# FQDN的全称是: Fully Qualified domain name. 技术上说必须以点号(period)终止.&lt;/p&gt;
&lt;p&gt;# AAAA 被称为 &amp;ldquo;quad A&amp;rdquo; rcord, 给出了从hostname到Ipv6地址的映射。 PTR用来把IP地址到hostname.&lt;/p&gt;
&lt;p&gt;# Entries in the DNS are known as Resource Records(RRs).&lt;/p&gt;
&lt;p&gt;# 一个点分十进制(dotted-decimal)IPv4的地址前加 0::ffff:就是 IPv6的字符串形式。&lt;/p&gt;
&lt;p&gt;# 与getpeername对应的函数不是gethostname而是getsockname.&lt;/p&gt;
&lt;p&gt;# getaddrinfo函数的host参数指定为dotted-decimal IPv4或 IPv6 hex string,会使得只有IPv4或IPv6的addrinfo返回。&lt;/p&gt;
&lt;p&gt;# 不给UDP套接字设置SO_REUSEADDR选项。We do not set the SO_REUSEADDR socket option for the UDP socket because this socket option can allow multiple sockets to bind the same UDP port on hosts that support multicasting. Since there is nothing like TCP&amp;rsquo;s TIME_WAIT state for a UDP socket, there is no need to set this socket option when the server is started.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Unix 网络编程 第十章 SCTP Client/Server Example</title>
      <link>https://ykyi.net/?p=313/</link>
      <pubDate>Mon, 19 Dec 2011 11:25:57 +0000</pubDate>
      <guid>https://ykyi.net/?p=313/</guid>
      <description>&lt;p&gt;这一章的内容还是满少的。也就是给出一个SCTP的简单例子。所以也没有太多需要做笔记的。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;什么是 head-of-line blocking.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Head-of-line blocking occurs when a TCP segment is lost and a subsequent TCP segment arrives out of order. That subsequent segment is held until the first TCP segment is retransmitted and arrives at the receiver.&lt;/p&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;&lt;strong&gt;怎么更改SCTP连接的stream的数量。&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;SCTP连接的streams的数量是在association的握手之前协商好的。对于FreeBSD的KAME实现，SCTP的outbound streams默认为10。这个值可以用setsocket函数更改。与SCTP_INITMSG scoket option相关，设置struct sctp_initmsg结构体。&lt;/p&gt;
&lt;p&gt;也可以用sendmsg函数发送ancillary数据来到达同样的目标。但发送ancillary data只对one-to-many形式的sctp socket有效。&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;&lt;strong&gt;怎么结束一个SCTP连接。&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;可以设置sctp_sndrcvinfo结构的sinfo_flags值的MSG_EOF flag来关闭一个sctp连接gracefully. This flag forces an association to shut down after the message being sent is acknowledged.&lt;/p&gt;
&lt;p&gt;还可以给sinfo_flags设置 MSG_ABORT。这样就会立即发送一个ABORT给peer端。任何还没来得及发送出的数据会被丢弃。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Unix网络编程.第五，六章笔记.</title>
      <link>https://ykyi.net/?p=284/</link>
      <pubDate>Sat, 10 Dec 2011 13:56:00 +0000</pubDate>
      <guid>https://ykyi.net/?p=284/</guid>
      <description>&lt;p&gt;# Unix世界里经常看到的 pst  是 pseudo terminal 的意思啊。&lt;/p&gt;
&lt;p&gt;# ps -t pts/6 -o pid,ppid,tty,stat,args,wchan&lt;/p&gt;
&lt;p&gt;ps 命令的进程状态。 S表示进程在睡眠，I表示进程在等待输入，O表示进程在等待输出。当进程在S状态时，wlan指示了更详细的状态信息。&lt;/p&gt;
&lt;p&gt;# SIGSTOP 和 SIGKILL 两个posix信号不可以被caught.&lt;/p&gt;
&lt;p&gt;# 缺省情况下，Unix的信号是不排在队列中的。这意味着多个相同signal到达的时候如果没有来得及处理，就只会记下一个signal.如果需要稳定的信号支持，就要使用RealTime Posix接口。&lt;/p&gt;
&lt;p&gt;# init 进程的PID是 1.&lt;/p&gt;
&lt;p&gt;# 可以用sigprocmask函数block和unblock信号。This let us protect a critical region of code by preventing certain signals from being caught while that region of code is executing.&lt;/p&gt;
&lt;p&gt;# 对于 Unix System V 和 Unix98, the child of a process does not become a zombie if the process sets the disposition of SIGCHLD to SIG_IGN. unfortunately, tis works only under System V &amp;amp; Unix98. Posix明确指票这个行为是未定义的。The portable way to handle zombies is to catch SIGCHILD &amp;amp; call wait or waitpid.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
