@@ -530,20 +530,27 @@ msgid ""
530530"client address as :attr:`self.client_address`; and the server instance as "
531531":attr:`self.server`, in case it needs access to per-server information."
532532msgstr ""
533+ "此函数必须执行为请求提供服务所需的全部操作。 默认实现不执行任何操作。 它有几个可用的实例属性;请求为 "
534+ ":attr:`self.request`;客户端地址为 :attr:`self.client_address`;服务器实例为 "
535+ ":attr:`self.server`,如果它需要访问特定服务器信息的话。"
533536
534537#: ../../library/socketserver.rst:412
535538msgid ""
536539"The type of :attr:`self.request` is different for datagram or stream "
537540"services. For stream services, :attr:`self.request` is a socket object; for"
538541" datagram services, :attr:`self.request` is a pair of string and socket."
539542msgstr ""
543+ "针对数据报或流服务的 :attr:`self.request` 类型是不同的。 对于流服务,:attr:`self.request` "
544+ "是一个套接字对象;对于数据报服务,:attr:`self.request` 是一对字符串与套接字。"
540545
541546#: ../../library/socketserver.rst:419
542547msgid ""
543548"Called after the :meth:`handle` method to perform any clean-up actions "
544549"required. The default implementation does nothing. If :meth:`setup` raises"
545550" an exception, this function will not be called."
546551msgstr ""
552+ "在 :meth:`handle` 方法之后调用以执行任何需要的清理操作。 默认实现不执行任何操作。 如果 :meth:`setup` "
553+ "引发了异常,此函数将不会被调用。"
547554
548555#: ../../library/socketserver.rst:427
549556msgid ""
@@ -553,6 +560,10 @@ msgid ""
553560"The :attr:`self.rfile` and :attr:`self.wfile` attributes can be read or "
554561"written, respectively, to get the request data or return data to the client."
555562msgstr ""
563+ ":class:`BaseRequestHandler` 子类重载了 :meth:`~BaseRequestHandler.setup` 和 "
564+ ":meth:`~BaseRequestHandler.finish` 方法,并提供了 :attr:`self.rfile` 和 "
565+ ":attr:`self.wfile` 属性。 :attr:`self.rfile` 和 :attr:`self.wfile` "
566+ "属性可以被分别读取或写入,以获取请求数据或将数据返回给客户端。"
556567
557568#: ../../library/socketserver.rst:434
558569msgid ""
@@ -561,31 +572,34 @@ msgid ""
561572":attr:`DatagramRequestHandler.wfile` supports the :class:`io.BufferedIOBase`"
562573" writable interface."
563574msgstr ""
575+ "这两个类的 :attr:`rfile` 属性都支持 :class:`io.BufferedIOBase` 可读接口,并且 "
576+ ":attr:`DatagramRequestHandler.wfile` 还支持 :class:`io.BufferedIOBase` 可写接口。"
564577
565578#: ../../library/socketserver.rst:439
566579msgid ""
567580":attr:`StreamRequestHandler.wfile` also supports the "
568581":class:`io.BufferedIOBase` writable interface."
569582msgstr ""
583+ ":attr:`StreamRequestHandler.wfile` 也支持 :class:`io.BufferedIOBase` 可写接口。"
570584
571585#: ../../library/socketserver.rst:445
572586msgid "Examples"
573587msgstr "例子"
574588
575589#: ../../library/socketserver.rst:448
576590msgid ":class:`socketserver.TCPServer` Example"
577- msgstr ""
591+ msgstr ":class:`socketserver.TCPServer` 示例 "
578592
579593#: ../../library/socketserver.rst:450 ../../library/socketserver.rst:549
580594msgid "This is the server side::"
581- msgstr ""
595+ msgstr "以下是服务端:: "
582596
583597#: ../../library/socketserver.rst:480
584598msgid ""
585599"An alternative request handler class that makes use of streams (file-like "
586600"objects that simplify communication by providing the standard file "
587601"interface)::"
588- msgstr ""
602+ msgstr "一个使用流(通过提供标准文件接口来简化通信的文件类对象)的替代请求处理句柄类:: "
589603
590604#: ../../library/socketserver.rst:495
591605msgid ""
@@ -594,6 +608,8 @@ msgid ""
594608"while the single ``recv()`` call in the first handler will just return what "
595609"has been sent from the client in one ``sendall()`` call."
596610msgstr ""
611+ "区别在于第二个处理句柄的 ``readline()`` 调用将多次调用 ``recv()`` 直至遇到一个换行符,而第一个处理句柄的单次 "
612+ "``recv()`` 调用只是返回在一次 ``sendall()`` 调用中由客户端发送的内容。"
597613
598614#: ../../library/socketserver.rst:501 ../../library/socketserver.rst:573
599615msgid "This is the client side::"
0 commit comments