@@ -535,20 +535,27 @@ msgid ""
535535"client address as :attr:`self.client_address`; and the server instance as "
536536":attr:`self.server`, in case it needs access to per-server information."
537537msgstr ""
538+ "此函数必须执行为请求提供服务所需的全部操作。 默认实现不执行任何操作。 它有几个可用的实例属性;请求为 "
539+ ":attr:`self.request`;客户端地址为 :attr:`self.client_address`;服务器实例为 "
540+ ":attr:`self.server`,如果它需要访问特定服务器信息的话。"
538541
539542#: ../../library/socketserver.rst:412
540543msgid ""
541544"The type of :attr:`self.request` is different for datagram or stream "
542545"services. For stream services, :attr:`self.request` is a socket object; for"
543546" datagram services, :attr:`self.request` is a pair of string and socket."
544547msgstr ""
548+ "针对数据报或流服务的 :attr:`self.request` 类型是不同的。 对于流服务,:attr:`self.request` "
549+ "是一个套接字对象;对于数据报服务,:attr:`self.request` 是一对字符串与套接字。"
545550
546551#: ../../library/socketserver.rst:419
547552msgid ""
548553"Called after the :meth:`handle` method to perform any clean-up actions "
549554"required. The default implementation does nothing. If :meth:`setup` raises"
550555" an exception, this function will not be called."
551556msgstr ""
557+ "在 :meth:`handle` 方法之后调用以执行任何需要的清理操作。 默认实现不执行任何操作。 如果 :meth:`setup` "
558+ "引发了异常,此函数将不会被调用。"
552559
553560#: ../../library/socketserver.rst:427
554561msgid ""
@@ -558,6 +565,10 @@ msgid ""
558565"The :attr:`self.rfile` and :attr:`self.wfile` attributes can be read or "
559566"written, respectively, to get the request data or return data to the client."
560567msgstr ""
568+ ":class:`BaseRequestHandler` 子类重载了 :meth:`~BaseRequestHandler.setup` 和 "
569+ ":meth:`~BaseRequestHandler.finish` 方法,并提供了 :attr:`self.rfile` 和 "
570+ ":attr:`self.wfile` 属性。 :attr:`self.rfile` 和 :attr:`self.wfile` "
571+ "属性可以被分别读取或写入,以获取请求数据或将数据返回给客户端。"
561572
562573#: ../../library/socketserver.rst:434
563574msgid ""
@@ -566,31 +577,34 @@ msgid ""
566577":attr:`DatagramRequestHandler.wfile` supports the :class:`io.BufferedIOBase`"
567578" writable interface."
568579msgstr ""
580+ "这两个类的 :attr:`rfile` 属性都支持 :class:`io.BufferedIOBase` 可读接口,并且 "
581+ ":attr:`DatagramRequestHandler.wfile` 还支持 :class:`io.BufferedIOBase` 可写接口。"
569582
570583#: ../../library/socketserver.rst:439
571584msgid ""
572585":attr:`StreamRequestHandler.wfile` also supports the "
573586":class:`io.BufferedIOBase` writable interface."
574587msgstr ""
588+ ":attr:`StreamRequestHandler.wfile` 也支持 :class:`io.BufferedIOBase` 可写接口。"
575589
576590#: ../../library/socketserver.rst:445
577591msgid "Examples"
578592msgstr "例子"
579593
580594#: ../../library/socketserver.rst:448
581595msgid ":class:`socketserver.TCPServer` Example"
582- msgstr ""
596+ msgstr ":class:`socketserver.TCPServer` 示例 "
583597
584598#: ../../library/socketserver.rst:450 ../../library/socketserver.rst:549
585599msgid "This is the server side::"
586- msgstr ""
600+ msgstr "以下是服务端:: "
587601
588602#: ../../library/socketserver.rst:480
589603msgid ""
590604"An alternative request handler class that makes use of streams (file-like "
591605"objects that simplify communication by providing the standard file "
592606"interface)::"
593- msgstr ""
607+ msgstr "一个使用流(通过提供标准文件接口来简化通信的文件类对象)的替代请求处理句柄类:: "
594608
595609#: ../../library/socketserver.rst:495
596610msgid ""
@@ -599,6 +613,8 @@ msgid ""
599613"while the single ``recv()`` call in the first handler will just return what "
600614"has been sent from the client in one ``sendall()`` call."
601615msgstr ""
616+ "区别在于第二个处理句柄的 ``readline()`` 调用将多次调用 ``recv()`` 直至遇到一个换行符,而第一个处理句柄的单次 "
617+ "``recv()`` 调用只是返回在一次 ``sendall()`` 调用中由客户端发送的内容。"
602618
603619#: ../../library/socketserver.rst:501 ../../library/socketserver.rst:573
604620msgid "This is the client side::"
0 commit comments