<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 真㊣的 porting</title>
	<atom:link href="http://www.jeffhung.net/blog/articles/jeffhung/1744/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/</link>
	<description>(My smile insists of having nose. :-)</description>
	<lastBuildDate>Thu, 03 Nov 2011 00:43:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2-alpha</generator>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135087</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Fri, 20 Mar 2009 10:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135087</guid>
		<description>&lt;p&gt;fr3@K,&lt;/p&gt;
&lt;p&gt;你提的這點，真的很有說服力耶：&lt;/p&gt;
&lt;blockquote&gt;
若 socket descriptor 在 shutdown 後不需要 close 卻還能被操作, 那擁有該 descriptor 的 process 何時把該 descriptor dereference 才對呢?
&lt;/blockquote&gt;
&lt;p&gt;我要好好再想一想，並更努力地再找一下資料，才能確定究竟應該如何 &lt;code class=&quot;inline_code&quot;&gt;close&lt;/code&gt;/&lt;code class=&quot;inline_code&quot;&gt;shutdown&lt;/code&gt;。XD&lt;/p&gt;
&lt;p&gt;jeffhung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>fr3@K,</p>
<p>你提的這點，真的很有說服力耶：</p>
<blockquote><p>
若 socket descriptor 在 shutdown 後不需要 close 卻還能被操作, 那擁有該 descriptor 的 process 何時把該 descriptor dereference 才對呢?
</p></blockquote>
<p>我要好好再想一想，並更努力地再找一下資料，才能確定究竟應該如何 <code class="inline_code">close</code>/<code class="inline_code">shutdown</code>。XD</p>
<p>jeffhung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fr3@K</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135069</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 20 Mar 2009 07:00:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135069</guid>
		<description>Hi jeffhung,

關於這個 &lt;code&gt;close&lt;/code&gt;/&lt;code&gt;shutdown&lt;/code&gt; 的問題, 或許你我都在心中有個預設答案, 因此各自把 UNP 以及其他地方找到的不是那麼一翻兩瞪眼的資訊解讀成為支持 (或至少不推翻) 自己認知的說法. 反省中...

Anyway, 還是請你考慮一下我上一個留言最後一段留下的問題.</description>
		<content:encoded><![CDATA[<p>Hi jeffhung,</p>
<p>關於這個 <code>close</code>/<code>shutdown</code> 的問題, 或許你我都在心中有個預設答案, 因此各自把 UNP 以及其他地方找到的不是那麼一翻兩瞪眼的資訊解讀成為支持 (或至少不推翻) 自己認知的說法. 反省中...</p>
<p>Anyway, 還是請你考慮一下我上一個留言最後一段留下的問題.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fr3@K</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135062</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 20 Mar 2009 06:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135062</guid>
		<description>Hi Jeffhung,

這幾個 figure 以及其說明, 是從 wire 上發生的事情來看 application 的 call flow.

如 figure 7.8, client 的 call flow 是 &lt;code&gt;write&lt;/code&gt; -&gt; &lt;code&gt;shutdown&lt;/code&gt; (SHUT_WR) -&gt; &lt;code&gt;read&lt;/code&gt; (blocks) -&gt; &lt;code&gt;read&lt;/code&gt; (returns 0), 其中並沒有以 &lt;code&gt;close&lt;/code&gt; 收尾.

在這個例子中, client 最後若呼叫了 &lt;code&gt;close&lt;/code&gt;, wire 上並不會發生任何事情, &lt;code&gt;close&lt;/code&gt; 只會單純的 dereference (and possibly incur relevant garbage collection). 因此我認為,  &lt;code&gt;close&lt;/code&gt; 沒有出現在這 figure 上並不奇怪.

另, 若 socket descriptor 在 &lt;code&gt;shutdown&lt;/code&gt; 後不需要 &lt;code&gt;close&lt;/code&gt; 卻還能被操作, 那擁有該 descriptor 的 process 何時把該 descriptor dereference 才對呢? 總不會有等所有的 descriptor 都 go out of scope 然後自動回收的機制吧 (類 shared_ptr)? 還是需要 programmer 呼叫  &lt;code&gt;close&lt;/code&gt;, 否則就要等到 process 結束.</description>
		<content:encoded><![CDATA[<p>Hi Jeffhung,</p>
<p>這幾個 figure 以及其說明, 是從 wire 上發生的事情來看 application 的 call flow.</p>
<p>如 figure 7.8, client 的 call flow 是 <code>write</code> -&gt; <code>shutdown</code> (SHUT_WR) -&gt; <code>read</code> (blocks) -&gt; <code>read</code> (returns 0), 其中並沒有以 <code>close</code> 收尾.</p>
<p>在這個例子中, client 最後若呼叫了 <code>close</code>, wire 上並不會發生任何事情, <code>close</code> 只會單純的 dereference (and possibly incur relevant garbage collection). 因此我認為,  <code>close</code> 沒有出現在這 figure 上並不奇怪.</p>
<p>另, 若 socket descriptor 在 <code>shutdown</code> 後不需要 <code>close</code> 卻還能被操作, 那擁有該 descriptor 的 process 何時把該 descriptor dereference 才對呢? 總不會有等所有的 descriptor 都 go out of scope 然後自動回收的機制吧 (類 shared_ptr)? 還是需要 programmer 呼叫  <code>close</code>, 否則就要等到 process 結束.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135056</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Fri, 20 Mar 2009 05:22:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135056</guid>
		<description>&lt;p&gt;James Chan,&lt;/p&gt;
&lt;p&gt;工程就是妥協，一切都要看「時程」啊。&lt;/p&gt;
&lt;p&gt;如果時間不夠，是我當然也是 tool chain 換一換，有問題的地方直接拿掉，最後不能跑再 call 廠商解決。:-p&lt;/p&gt;
&lt;p&gt;不過也要看啦，之前 porting AIX，IBM 的協力 SI 廠商碰到問題一樣是一問三不知，還是得什麼都自己來。&lt;/p&gt;
&lt;p&gt;evil jeffhung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>James Chan,</p>
<p>工程就是妥協，一切都要看「時程」啊。</p>
<p>如果時間不夠，是我當然也是 tool chain 換一換，有問題的地方直接拿掉，最後不能跑再 call 廠商解決。:-p</p>
<p>不過也要看啦，之前 porting AIX，IBM 的協力 SI 廠商碰到問題一樣是一問三不知，還是得什麼都自己來。</p>
<p>evil jeffhung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135054</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Fri, 20 Mar 2009 05:14:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135054</guid>
		<description>&lt;p&gt;fr3@K,&lt;/p&gt;
&lt;p&gt;根據《Unix Network Programming》，Section 7.5 的 &lt;code class=&quot;inline_code&quot;&gt;SO_LINGER&lt;/code&gt; Socket Option 這一段，&lt;code class=&quot;inline_code&quot;&gt;shutdown&lt;/code&gt; 與 &lt;code class=&quot;inline_code&quot;&gt;close&lt;/code&gt; 的使用，還有許多奧妙存在，看來值得再寫一篇。&lt;/p&gt;
&lt;p&gt;不過，這段裡面有提到一句：&lt;/p&gt;
&lt;blockquote&gt;
Comparing this figure to Figures 7.7 and 7.8 we see that when we close our end of the connection, depending on the function called (&lt;code class=&quot;inline_code&quot;&gt;close&lt;/code&gt; or &lt;code class=&quot;inline_code&quot;&gt;shutdown&lt;/code&gt;) and whether the &lt;code class=&quot;inline_code&quot;&gt;SO_LINGER&lt;/code&gt; socket option is set, the return can occur at three different times:...
&lt;/blockquote&gt;
從這段話來看，&lt;code class=&quot;inline_code&quot;&gt;shutdown&lt;/code&gt; 與 &lt;code class=&quot;inline_code&quot;&gt;close&lt;/code&gt; 依然是互相取代的。目前我還是找不到，在 UNIX 上，呼叫了 &lt;code class=&quot;inline_code&quot;&gt;shutdown&lt;/code&gt; 還必須再呼叫 &lt;code class=&quot;inline_code&quot;&gt;close&lt;/code&gt; 的說法。&lt;/p&gt;
&lt;p&gt;jeffhung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>fr3@K,</p>
<p>根據《Unix Network Programming》，Section 7.5 的 <code class="inline_code">SO_LINGER</code> Socket Option 這一段，<code class="inline_code">shutdown</code> 與 <code class="inline_code">close</code> 的使用，還有許多奧妙存在，看來值得再寫一篇。</p>
<p>不過，這段裡面有提到一句：</p>
<blockquote><p>
Comparing this figure to Figures 7.7 and 7.8 we see that when we close our end of the connection, depending on the function called (<code class="inline_code">close</code> or <code class="inline_code">shutdown</code>) and whether the <code class="inline_code">SO_LINGER</code> socket option is set, the return can occur at three different times:...
</p></blockquote>
<p>從這段話來看，<code class="inline_code">shutdown</code> 與 <code class="inline_code">close</code> 依然是互相取代的。目前我還是找不到，在 UNIX 上，呼叫了 <code class="inline_code">shutdown</code> 還必須再呼叫 <code class="inline_code">close</code> 的說法。</p>
<p>jeffhung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Chan</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135053</link>
		<dc:creator>James Chan</dc:creator>
		<pubDate>Fri, 20 Mar 2009 04:36:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135053</guid>
		<description>客戶的Engineer如果都這樣子就好了!!
有個客戶要把Intel的WPS(wsccmd)從我們的板子(MIPS)porting到他們的板子(Intel IXP435)上
他的認知竟然是,只要把tool chain換成他們的就好,有問題的地方就拿掉 (直接用 /**/ 拿掉)
然後再跟我們抱怨有些功能不會動.</description>
		<content:encoded><![CDATA[<p>客戶的Engineer如果都這樣子就好了!!<br />
有個客戶要把Intel的WPS(wsccmd)從我們的板子(MIPS)porting到他們的板子(Intel IXP435)上<br />
他的認知竟然是,只要把tool chain換成他們的就好,有問題的地方就拿掉 (直接用 /**/ 拿掉)<br />
然後再跟我們抱怨有些功能不會動.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fr3@K</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135049</link>
		<dc:creator>fr3@K</dc:creator>
		<pubDate>Fri, 20 Mar 2009 03:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135049</guid>
		<description>Hi Jeffhung,

關於 Stevens 的那句話, 你可能理解的不夠正確. 前半段的重點似乎沒得到你的注意:
&lt;blockquote&gt;If we really want to send a FIN on a TCP connection...&lt;/blockquote&gt;

&lt;code&gt;shutdown&lt;/code&gt; 絕不能替代 &lt;code&gt;close&lt;/code&gt;/&lt;code&gt;closesocket&lt;/code&gt;, 前者是在操作一個 socket, 後者是 dereference 一個 socket.

例如, 一個被以 &lt;code&gt;shutdown(sockfd, SHUT_WR)&lt;/code&gt; 的 socket 依然是 valid socket (desciptor). 它會 ACK incoming packets, 也會把 data 放進 receive queue, application 也可以把 data 從 queue 讀進來.

我注意了一下 UNP 上面的幾個相關範例. 在掃過的範例中, 的確大都在 &lt;code&gt;shutdown&lt;/code&gt; 後沒有 &lt;code&gt;close&lt;/code&gt;. 但它們都是短命的程式, 基本上在 &lt;code&gt;shutdown&lt;/code&gt; 後 process 就結束掉了. 我認為在這些範例中, Stevens 是利用 process 的 life scope 來作 garbage collection, 並不是以 &lt;code&gt;shutdown&lt;/code&gt; 取代 &lt;code&gt;close&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>Hi Jeffhung,</p>
<p>關於 Stevens 的那句話, 你可能理解的不夠正確. 前半段的重點似乎沒得到你的注意:</p>
<blockquote><p>If we really want to send a FIN on a TCP connection...</p></blockquote>
<p><code>shutdown</code> 絕不能替代 <code>close</code>/<code>closesocket</code>, 前者是在操作一個 socket, 後者是 dereference 一個 socket.</p>
<p>例如, 一個被以 <code>shutdown(sockfd, SHUT_WR)</code> 的 socket 依然是 valid socket (desciptor). 它會 ACK incoming packets, 也會把 data 放進 receive queue, application 也可以把 data 從 queue 讀進來.</p>
<p>我注意了一下 UNP 上面的幾個相關範例. 在掃過的範例中, 的確大都在 <code>shutdown</code> 後沒有 <code>close</code>. 但它們都是短命的程式, 基本上在 <code>shutdown</code> 後 process 就結束掉了. 我認為在這些範例中, Stevens 是利用 process 的 life scope 來作 garbage collection, 並不是以 <code>shutdown</code> 取代 <code>close</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135042</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Fri, 20 Mar 2009 02:56:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135042</guid>
		<description>&lt;p&gt;CHL,&lt;/p&gt;
&lt;p&gt;先學 Windows SDK 底子才夠，不過 Charles Petzold 的書看完，概念就差不多了。&lt;/p&gt;
&lt;p&gt;進階的書或雜誌的話，我就沒什麼研究了，基本上 MSDN + Google + CodeProject 就已經很豐富，夠處理大部分會遇到的問題了。&lt;/p&gt;
&lt;p&gt;jeffhung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>CHL,</p>
<p>先學 Windows SDK 底子才夠，不過 Charles Petzold 的書看完，概念就差不多了。</p>
<p>進階的書或雜誌的話，我就沒什麼研究了，基本上 MSDN + Google + CodeProject 就已經很豐富，夠處理大部分會遇到的問題了。</p>
<p>jeffhung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CHL</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135039</link>
		<dc:creator>CHL</dc:creator>
		<pubDate>Fri, 20 Mar 2009 02:50:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135039</guid>
		<description>謝謝版大的分享.
想再請問版大, 是先學Windos API (SDK)? 還是從MFC學起?
.net 我可能暫時不會考慮.
另外再請教版大, 請問除了MSDN外, 是否有推薦的補充教材? 例如book或是雜誌?

MSDN我會努力study的. 
謝謝版大不吝指教.</description>
		<content:encoded><![CDATA[<p>謝謝版大的分享.<br />
想再請問版大, 是先學Windos API (SDK)? 還是從MFC學起?<br />
.net 我可能暫時不會考慮.<br />
另外再請教版大, 請問除了MSDN外, 是否有推薦的補充教材? 例如book或是雜誌?</p>
<p>MSDN我會努力study的.<br />
謝謝版大不吝指教.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-135022</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Thu, 19 Mar 2009 22:56:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-135022</guid>
		<description>&lt;p&gt;CHL,&lt;/p&gt;
&lt;p&gt;先讀完 Charles Petzold 的《Programming Windows 95》，對 Windows Programming 的基本架構，有個認識之後，再選擇一套 GUI framework，尋其 bible 級入門書詳讀後，最後就是不斷地練習，再練習。&lt;/p&gt;
&lt;p&gt;MSDN 要勤讀、詳讀，使用的所有函式，甚至包括 standard C 的函式如 &lt;code class=&quot;inline_code&quot;&gt;strcpy&lt;/code&gt; 等，統統都要一個一個去找出 MSDN 頁面，把裡面所有內容讀完。&lt;/p&gt;
&lt;p&gt;需要特殊功能，可以先找 &lt;a href=&quot;http://www.codeproject.com/&quot; rel=&quot;nofollow&quot;&gt;CodeProject&lt;/a&gt; 這個網站，這是 Windows Programming 的大寶庫。&lt;/p&gt;
&lt;p&gt;最後，再強調一次，MSDN 要細讀、詳讀。&lt;/p&gt;
&lt;p&gt;祝好運。XD&lt;/p&gt;
&lt;p&gt;jeffhung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>CHL,</p>
<p>先讀完 Charles Petzold 的《Programming Windows 95》，對 Windows Programming 的基本架構，有個認識之後，再選擇一套 GUI framework，尋其 bible 級入門書詳讀後，最後就是不斷地練習，再練習。</p>
<p>MSDN 要勤讀、詳讀，使用的所有函式，甚至包括 standard C 的函式如 <code class="inline_code">strcpy</code> 等，統統都要一個一個去找出 MSDN 頁面，把裡面所有內容讀完。</p>
<p>需要特殊功能，可以先找 <a href="http://www.codeproject.com/" rel="nofollow">CodeProject</a> 這個網站，這是 Windows Programming 的大寶庫。</p>
<p>最後，再強調一次，MSDN 要細讀、詳讀。</p>
<p>祝好運。XD</p>
<p>jeffhung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CHL</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-134999</link>
		<dc:creator>CHL</dc:creator>
		<pubDate>Thu, 19 Mar 2009 17:28:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-134999</guid>
		<description>請教jeffhung版大,
   因小弟正在學習Win32 programming (使用VC6), 雖然有C/C++的基礎, 但卻仍然有不得其門而入的感覺, 請教版大可否分享學習Win32 programming的心得, 或是指引一個方向, 謝謝.</description>
		<content:encoded><![CDATA[<p>請教jeffhung版大,<br />
   因小弟正在學習Win32 programming (使用VC6), 雖然有C/C++的基礎, 但卻仍然有不得其門而入的感覺, 請教版大可否分享學習Win32 programming的心得, 或是指引一個方向, 謝謝.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-134980</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Thu, 19 Mar 2009 14:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-134980</guid>
		<description>&lt;p&gt;av,&lt;/p&gt;
&lt;p&gt;我最近有空時，會練習自己實作 C++0x 的 std-lib (比較簡單的部份XD)，然後就發現，其實 boost 與 C++0x 並沒有 100% 相容，很多細節不太一樣。看來屆時從 boost 進化到 C++0x，還有一段路要走啊。&lt;/p&gt;
&lt;p&gt;jeffhung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>av,</p>
<p>我最近有空時，會練習自己實作 C++0x 的 std-lib (比較簡單的部份XD)，然後就發現，其實 boost 與 C++0x 並沒有 100% 相容，很多細節不太一樣。看來屆時從 boost 進化到 C++0x，還有一段路要走啊。</p>
<p>jeffhung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: av</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1744/comment-page-1/#comment-134974</link>
		<dc:creator>av</dc:creator>
		<pubDate>Thu, 19 Mar 2009 14:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/?p=1744#comment-134974</guid>
		<description>本文中講的三類工作：thread, file I/O, network 都可以用 boost 解決，這樣跨平台就沒問題了! boost 萬歲! XD</description>
		<content:encoded><![CDATA[<p>本文中講的三類工作：thread, file I/O, network 都可以用 boost 解決，這樣跨平台就沒問題了! boost 萬歲! XD</p>
]]></content:encoded>
	</item>
</channel>
</rss>

