Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a62e2c

Browse files
docs(howto/sockets.po): 翻譯 sockets.rst:5 到 sockets.rst:106 區塊 (#471)
* docs(howto/sockets.po): 翻譯 sockets.rst:5 到 sockets.rst:106 區塊gh-466* docs(howto/sockets.po): 去除不必要的空白gh-466* docs(howto/sockets.po): 修改名詞、文法修改成更適合的名詞、文法,標點符號gh-466---------Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
1 parentca1538f commit5a62e2c

File tree

1 file changed

+62
-5
lines changed

1 file changed

+62
-5
lines changed

‎howto/sockets.po

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ msgstr ""
88
"Project-Id-Version:Python 3.11\n"
99
"Report-Msgid-Bugs-To:\n"
1010
"POT-Creation-Date:2022-06-10 00:16+0000\n"
11-
"PO-Revision-Date:2018-05-23 14:37+0000\n"
12-
"Last-Translator:Adrian Liaw <adrianliaw2000@gmail.com>\n"
11+
"PO-Revision-Date:2023-07-12 02:22+0800\n"
12+
"Last-Translator:Jay <weijay0804@gmail.com>\n"
1313
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
1515
"Language:zh_TW\n"
1616
"MIME-Version:1.0\n"
1717
"Content-Type:text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding:8bit\n"
1919
"Plural-Forms:nplurals=1; plural=0;\n"
20+
"X-Generator:Poedit 3.3.2\n"
2021

2122
#:../../howto/sockets.rst:5
2223
msgid"Socket Programming HOWTO"
23-
msgstr""
24+
msgstr"Socket 程式設計指南"
2425

2526
#:../../howto/sockets.rst:0
2627
msgid"Author"
@@ -43,6 +44,10 @@ msgid ""
4344
"a lot of them), but I hope it will give you enough background to begin using "
4445
"them decently."
4546
msgstr""
47+
"Sockets 在各處都被廣泛使用,但卻是一項被誤解最嚴重的技術之一。這是一篇對 "
48+
"sockets 的概論介紹。這並不是一個完整的教學指南 - 你還需要做許多準備才能讓 "
49+
"sockets 正常運作。這篇文章也沒有包含細節(其中有非常多的細節),但我希望這篇"
50+
"文章能夠讓你有足夠的背景知識,以便開始正確的使用 sockets 程式設計。"
4651

4752
#:../../howto/sockets.rst:20
4853
msgid"Sockets"
@@ -59,6 +64,13 @@ msgid ""
5964
"blocking sockets. But I'll start by talking about blocking sockets. You'll "
6065
"need to know how they work before dealing with non-blocking sockets."
6166
msgstr""
67+
"我只會討論關於 INET(例如:IPv4)的 sockets,但它們涵蓋了幾乎 99% 的 "
68+
"sockets 使用場景。而我也將僅討論關於 STREAM(比如:TCP)類型的 sockets - 除"
69+
"非你真的知道你在做什麼(在這種情況下,這份指南可能不適合你),使用 STREAM "
70+
"類型的 socket 會獲得比其他 sockets 類型更好的表現和性能。我將會嘗試解釋 "
71+
"socket 是什麼,以及如何使用阻塞 (blocking) 和非阻塞 (non-blocking) sockets 的"
72+
"一些建議。但首先我會先談論阻塞 sockets。在處理非阻塞 sockets 之前,你需要了解"
73+
"它們的工作原理。"
6274

6375
#:../../howto/sockets.rst:31
6476
msgid""
@@ -70,10 +82,16 @@ msgid ""
7082
"sockets exclusively; the web server it's talking to uses both\"server\" "
7183
"sockets and\"client\" sockets."
7284
msgstr""
85+
"要理解這些東西的困難點之一在於\"scoket\" 可以代表多種具有些微差異的東西,這主要"
86+
"取決於上下文。所以首先,讓我們先區分「用戶端 (client)」socket 和「伺服器端"
87+
" (server)」socket 的差別,「用戶端」socket 表示通訊的一端,「伺服器端」"
88+
"socket 更像是一個電話總機接線員。用戶端應用程式(例如:你的瀏覽器)只能使"
89+
"用「用戶端」socket; 它所連接的網路伺服器則同時使用「伺服器端」socket 和 "
90+
"「用戶端」socket 來進行通訊。"
7391

7492
#:../../howto/sockets.rst:40
7593
msgid"History"
76-
msgstr""
94+
msgstr"歷史"
7795

7896
#:../../howto/sockets.rst:42
7997
msgid""
@@ -82,6 +100,9 @@ msgid ""
82100
"other forms of IPC that are faster, but for cross-platform communication, "
83101
"sockets are about the only game in town."
84102
msgstr""
103+
"在各種形式的 :abbr:`IPC (Inter Process Communication)` 中,sockets 是最受歡迎"
104+
"的。在任何特定的平台上,可能會存在其他更快速的 IPC 形式,但對於跨平台通訊來"
105+
"說,sockets 是唯一的選擇。"
85106

86107
#:../../howto/sockets.rst:47
87108
msgid""
@@ -90,16 +111,22 @@ msgid ""
90111
"of sockets with INET makes talking to arbitrary machines around the world "
91112
"unbelievably easy (at least compared to other schemes)."
92113
msgstr""
114+
"Sockets 作為 Unix 的 BSD 分支的一部分在 Berkeley 被發明出來。它們隨著網際網路的普"
115+
"及而迅速蔓延開來。這是有很好的理由 — sockets 和 INET 的結合讓世界各地任何"
116+
"的機器之間的通訊變得非常簡單(至少與其它方案相比是如此)。"
93117

94118
#:../../howto/sockets.rst:54
95119
msgid"Creating a Socket"
96-
msgstr""
120+
msgstr"建立一個 Socket"
97121

98122
#:../../howto/sockets.rst:56
99123
msgid""
100124
"Roughly speaking, when you clicked on the link that brought you to this "
101125
"page, your browser did something like the following::"
102126
msgstr""
127+
"大致上來說,當你點擊了帶你來到這個頁面的連結時,你的瀏覽器做了以下的操作:\n"
128+
"\n"
129+
"::"
103130

104131
#:../../howto/sockets.rst:64
105132
msgid""
@@ -108,12 +135,19 @@ msgid ""
108135
"then be destroyed. That's right, destroyed. Client sockets are normally only "
109136
"used for one exchange (or a small set of sequential exchanges)."
110137
msgstr""
138+
"當 ``connect`` 完成時,這個 socket ``s`` 可以用來發送請求來取得頁面的文本。同"
139+
"一個 socket 也會讀取回傳值,然後再被銷毀。是的,會被銷毀。用戶端 socket 通常只"
140+
"用來做一次交換(或是一小組連續交換)。"
111141

112142
#:../../howto/sockets.rst:70
113143
msgid""
114144
"What happens in the web server is a bit more complex. First, the web server "
115145
"creates a\"server socket\"::"
116146
msgstr""
147+
"網路伺服器 (web server) 的運作就稍微複雜一點。首先,網路伺服器會建立一個「伺服器端 "
148+
"socket」:\n"
149+
"\n"
150+
"::"
117151

118152
#:../../howto/sockets.rst:80
119153
msgid""
@@ -124,13 +158,19 @@ msgid ""
124158
"machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any "
125159
"address the machine happens to have."
126160
msgstr""
161+
"有幾件事需要注意:我們使用了 ``socket.gethostname()``,這樣 socket 才能對外"
162+
"部網路可見。如果我們使用了 ``s.bind(('localhost', 80))`` 或 ``s."
163+
"bind(('127.0.0.1', 80))``,我們會得到一個「伺服器端」socket,但是只能在同一"
164+
"台機器內可見。``s.bind(('', 80))`` 指定 socket 可以透過機器的任何地址存取。"
127165

128166
#:../../howto/sockets.rst:87
129167
msgid""
130168
"A second thing to note: low number ports are usually reserved for\"well "
131169
"known\" services (HTTP, SNMP etc). If you're playing around, use a nice high "
132170
"number (4 digits)."
133171
msgstr""
172+
"第二個要注意的是:數字小的連接埠 (port) 通常保留給「廣為人知的」服務(HTTP、SNMP"
173+
"等)。如果你只是想執行程式,可以使用一個數字較大的連接埠(4 位數字)。"
134174

135175
#:../../howto/sockets.rst:91
136176
msgid""
@@ -139,12 +179,19 @@ msgid ""
139179
"outside connections. If the rest of the code is written properly, that "
140180
"should be plenty."
141181
msgstr""
182+
"最後,``listen`` 引數告訴 socket 函式庫 (library),我們希望在佇列 (queue) 中"
183+
"累積達 5 個(正常的最大值)連接請求後再拒絕外部連接。如果其餘的程式碼編寫"
184+
"正確,這應該足夠了。"
142185

143186
#:../../howto/sockets.rst:95
144187
msgid""
145188
"Now that we have a\"server\" socket, listening on port 80, we can enter the "
146189
"mainloop of the web server::"
147190
msgstr""
191+
"現在我們有一個監聽 80 連接埠的「伺服器端」socket 了,我們可以進入網路伺服器的"
192+
"主迴圈了:\n"
193+
"\n"
194+
"::"
148195

149196
#:../../howto/sockets.rst:106
150197
msgid""
@@ -161,6 +208,16 @@ msgid ""
161208
"The two\"clients\" are free to chat it up - they are using some dynamically "
162209
"allocated port which will be recycled when the conversation ends."
163210
msgstr""
211+
"事實上,有三種方法可以讓這個迴圈運作 - 分配一個執行緒 (thread) 來處理 "
212+
"``clientsocket`` 、建立一個新行程 (process) 來處理 ``clientsocket``,或者將"
213+
"這個程式重新改寫成使用非阻塞 socket,並使用 ``select`` 在我們的「伺服器端」"
214+
"socket 和任何有效的 ``clientsocket`` 之間進行多工處理。稍後將會更詳細的介紹。"
215+
"現在最重要的是理解:這就是「伺服器端」socket 做的\\ *所有*\\事情。它不會發送任何"
216+
"資料、也不接收任何資料,它只會建立「伺服器端」socket。每個 ``clientsocket`` "
217+
"都是為了回應某些\\ *其他*\\ ``connect()`` 到我們綁定的主機上的「用戶端」socket。"
218+
"一但 ``clientsocket`` 建立完成,就會繼續監聽更多的連接請求。兩個「用戶端」可"
219+
"以隨意的通訊 - 它們使用的是一些動態分配的連接埠,會在通訊結束的時候被回收並重新"
220+
"利用。"
164221

165222
#:../../howto/sockets.rst:121
166223
msgid"IPC"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp