@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version : Python 3.11\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"POT-Creation-Date : 2022-06-10 00:16+0000\n "
11
- "PO-Revision-Date : 2023-07-19 20:17 +0800\n "
11
+ "PO-Revision-Date : 2023-08-03 18:11 +0800\n "
12
12
"
Last-Translator :
Jay <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -417,7 +417,7 @@ msgstr ""
417
417
418
418
#: ../../howto/sockets.rst:252
419
419
msgid "Binary Data"
420
- msgstr ""
420
+ msgstr "二進位資料 "
421
421
422
422
#: ../../howto/sockets.rst:254
423
423
msgid ""
@@ -430,6 +430,13 @@ msgid ""
430
430
"little-endian, with the least significant byte first - that same ``1`` would "
431
431
"be ``01 00``."
432
432
msgstr ""
433
+ "使用 socket 傳輸二進位資料完全是可行的。最主要的問題在於不同機器使用不同的二"
434
+ "進位資料格式。例如,`網路二進位順序 <https://en.wikipedia.org/wiki/"
435
+ "Endianness#Networking>`_ 採用的是「大端序 big-endian」,"
436
+ "所以一個值為 ``1`` 的 16 位元整數會表示成兩個 16 進位的位元組 ``00 01``。然而"
437
+ "大多數常見的處理器 (x86/AMD64,ARM,RISC-V) 採用的是「小端序 little-"
438
+ "endian」,所以相同的 ``1`` 會被表示成 ``01 00``。"
439
+ "(譯者注:將一個多位數的低位放在較小的位址處,高位放在較大的位址處,則稱小端序;反之則稱大端序。)"
433
440
434
441
#: ../../howto/sockets.rst:262
435
442
msgid ""
@@ -439,6 +446,10 @@ msgid ""
439
446
"these do nothing, but where the machine is byte-reversed, these swap the "
440
447
"bytes around appropriately."
441
448
msgstr ""
449
+ "Socket 函式庫提供了用於轉換 16 位元和 32 位元整數的函式 - ``ntohl, htonl, "
450
+ "ntohs, htons``,其中 \" n\" 表示 *network*,\" h\" 表示 *host*,\" s\" 表示 "
451
+ "*short*,\" l\" 表示 *long*。當網路的位元組順序和主機位元組順序相同時,這些函"
452
+ "式不會做任何操作,但當主機的位元組順序相反時,這些函式會適當的交換位元組順序。"
442
453
443
454
#: ../../howto/sockets.rst:268
444
455
msgid ""
@@ -449,10 +460,14 @@ msgid ""
449
460
"be 8. Of course, this doesn't fit well with fixed-length messages. "
450
461
"Decisions, decisions."
451
462
msgstr ""
463
+ "在現今的 64 位元機器中,二進位資料的 ASCII 表示通常會比二進位表示要小,這是因"
464
+ "為在很多情況下,大多數整數的值為 0 或者 1。例如,字串形式的 ``\" 0\" `` 是兩個"
465
+ "位元組,而完整的 64 位元整數則是 8 個位元組。當然,這對固定長度的訊息來說不太"
466
+ "適合,需要自行決定。"
452
467
453
468
#: ../../howto/sockets.rst:277
454
469
msgid "Disconnecting"
455
- msgstr ""
470
+ msgstr "結束連線 "
456
471
457
472
#: ../../howto/sockets.rst:279
458
473
msgid ""
@@ -465,6 +480,12 @@ msgid ""
465
480
"same as ``shutdown(); close()``. So in most situations, an explicit "
466
481
"``shutdown`` is not needed."
467
482
msgstr ""
483
+ "嚴格來說,在關閉 socket 前,你應該使用 ``shutdown`` 函式。``shutdown`` 函式是"
484
+ "發送給 socket 另一端的一個提醒。根據你傳遞的引數,它可以表示「我不會再發送任"
485
+ "何訊息了,但我仍然會持續監聽」,或者是「我不會再繼續監聽了,真讚!」。然而,"
486
+ "大多數的 socket 函式庫或程式設計師都習慣忽略這種禮節,因為通常情況下 "
487
+ "``close`` 跟 ``shutdown(); close()`` 是一樣的。所以在大多數情況下,不需要再特"
488
+ "地使用 ``shutdown`` 了。"
468
489
469
490
#: ../../howto/sockets.rst:287
470
491
msgid ""
@@ -475,6 +496,11 @@ msgid ""
475
496
"complete request. The server sends a reply. If the ``send`` completes "
476
497
"successfully then, indeed, the client was still receiving."
477
498
msgstr ""
499
+ "有效使用 ``shutdown`` 的一種方式是在類似 HTTP 的交換中,用戶端發送請求後,然"
500
+ "後使用 ``shutdown(1)``。這告訴伺服器「這個用戶端已經發送完成,但仍可以接"
501
+ "收」。伺服器可以通過接收「零位元組」來檢測 \" EOF\" 。這樣它就可以確定已經接收到"
502
+ "完整的請求。伺服器發送回覆,如果 ``send`` 成功完成,那麼用戶端確實在持續接"
503
+ "收。"
478
504
479
505
#: ../../howto/sockets.rst:294
480
506
msgid ""
@@ -485,6 +511,11 @@ msgid ""
485
511
"indefinitely, thinking you're just being slow. *Please* ``close`` your "
486
512
"sockets when you're done."
487
513
msgstr ""
514
+ "Python 更進一步地採取自動關閉的步驟,並且當 socket 被垃圾回收機制回收時,如果需要"
515
+ "的話,他會自動執行 ``close``。但依賴這個機制是一個非常不好的習慣,如果你的 "
516
+ "socket 在沒有 ``close`` 的情況下消失了,那麼另一端的 socket 可能會認為你只是"
517
+ "慢了一步,而無期限的等待。*請務必* \\ 在使用完畢後使用 ``close`` 關閉你的 "
518
+ "sockets。"
488
519
489
520
#: ../../howto/sockets.rst:302
490
521
msgid "When Sockets Die"
0 commit comments