Posted on August 15th, 2009 at 18:39 by fr3@K
A great read on how to properly teardown a connection of synchronous protocols (e.g. HTTP) on the server side.
via: SO_LINGER is not the same as Apache’s “lingering close”.
A great read on how to properly teardown a connection of synchronous protocols (e.g. HTTP) on the server side.
via: SO_LINGER is not the same as Apache’s “lingering close”.
昨天在網上閒逛, 在樂多上看到篇名為 “Socket Programming in C 常犯的錯誤” 的短文. 這短文作者的動機很好, 指出常見到的錯誤並提供個人看法與可能較好的作法. 這樣的行為很值得鼓勵. 但極可惜的是, 結果卻是很不理想的. 容我說句重話, 如果是考試的話該文是得不到我的分數的.
(more…)
一直想找時間把最新的 draft-ietf-mmusic-ice-16 好好拜讀. 以彌補我從第 7 (還是 8?) 個 draft 就空到現在的空窗. 但總是提不起勁來實踐.
現在無論如何, 我已經決定要利用這個禮拜下班時間與接下來的週末自由的時間來把它 K 完.
續自 NAT Traversal, part 2 – STUN.
像是 MSN messenger 等的傳統 IM (Instant Message) 網路, 其 server 只負責少許的任務, 絕大部分的工作都是一個 client 節點與別的 client 節點之間的事情. 即便如此, 在這種網路之中, 每一個 client 還是從頭到尾都是與 server 溝通, 從來不會直接對另一個 client 收發訊息. Server 除了一開始對 client 認證, 後續除了 relay (轉發) 訊息與 data (例如檔案傳輸) 之外, 幾乎就沒別的任務. 對 service provider 來說, 這種架構可說是非常浪費網路資源. 每一個經過 server relay 的封包, 都代表對 service provider 頻寬與計算能力的損耗.
續自 NAT Traversal, part 1 – NAT Behavior.
STUN 是個非常簡單的 protocol. 就只一種功能性的 request - Binding Request. 可以先簡單想像為 ping, 不同之處在於 server 的 response 會將 client 發出 request 的 source ip:port 放在裡面回應.
應該有不少人跟我一樣, 有好幾個在不同的地方 shell 帳號. 有自己的機器上的, 有公司的, 有花錢租的 virtual host, 有參加 FOSS 相關計畫用的. 這些帳號 (login name) 常不一樣.
當我在這些機器上 ssh 過來 ssh 過去的時候, 常得多敲好幾個鍵, 把 login name 餵給 ssh. 今天被這事情搞煩了, 認真把 ssh_config 的 man page 看了, 產出就是 ~/.ssh/config:
# Office
Host office-domain.name *.office-domain.name 192.168.* some-office-machine-name
User login-name-at-office
# Some project
Host shell.foss-project.org
User another-login-name
NAT (不包含防火牆) 處理 UDP 封包的行為中, 對 p2p 影響最大的兩類為:
根據 wikipedia 的定義, 一個 peer-to-peer (p2p) computer network 是一個主要依賴該網路上參與者 (相對於依賴服務器) 的運算能力與帶寬的網路.
SSH port forwarding 也稱為 SSH tunneling. 這個功能可把連到一個 ssh session 其中一端某個 port 的 TCP connection, 透過加密的 channel,forward 到 session 的另外一端的指定端口. 將開啟 port forwarding 的 ssh session 結束掉, port forwarding 也跟著結束.
下面的 command 會建立一個從 firedrake (我的電腦) 連到 fsfoundry.org 的 ssh session. 並且在 firedrake 的 localhost 的 port 8080 等待 incoming connection. 當有 connection 連進來, 該 connection 就會被 forward 到 fsfoundry.org 的 localhost port 3128:
firedrake$ ssh fsfoundry.org -L 8080:localhost:3128
相反地, 下面的 command 會建立一個從 firedrake 連到 fsfoundry.org 的 ssh session. 並且在 fsfoundry.org 的 localhost 的 port 3128 等待 incoming connection. 當有 connection 連進來, 該 connection 就會被 forward 到 firedrake 的 localhost port 8080:
firedrake$ ssh fsfoundry.org -R 8080:localhost:3128
建立一個連到 fsfoundry.org 的 ssh session. 這個 session 會把在其 session 內開的 X11 application forward 回到 firedrake 的 X Server.
firedrake$ ssh -X fsfoundry.org
比較舊版的 OpenSSH 用的是 -Y 而不是 -X.
Except where otherwise noted, COdE fr3@K by
fr3@K is licensed under a
Creative Commons Attribution-Share Alike 3.0 License.