PageRenderTime 60ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/locale/pot/library/socket.pot

https://bitbucket.org/pydocja/py33
Unknown | 1059 lines | 859 code | 200 blank | 0 comment | 0 complexity | 5d11454f0601b21097ce3221d1b47e5a MD5 | raw file
  1. # SOME DESCRIPTIVE TITLE.
  2. # Copyright (C) 1990-2013, Python Software Foundation
  3. # This file is distributed under the same license as the Python package.
  4. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5. #
  6. #, fuzzy
  7. msgid ""
  8. msgstr ""
  9. "Project-Id-Version: Python 3.3\n"
  10. "Report-Msgid-Bugs-To: \n"
  11. "POT-Creation-Date: 2013-12-30 03:15+0900\n"
  12. "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  13. "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  14. "Language-Team: LANGUAGE <LL@li.org>\n"
  15. "MIME-Version: 1.0\n"
  16. "Content-Type: text/plain; charset=UTF-8\n"
  17. "Content-Transfer-Encoding: 8bit\n"
  18. #: ../../library/socket.rst:2
  19. # 0236b58df588443eb76a12ea95636e8d
  20. msgid ":mod:`socket` --- Low-level networking interface"
  21. msgstr ""
  22. #: ../../library/socket.rst:8
  23. # 39ac663abd6946c1acad4bb1e2679a2b
  24. msgid "This module provides access to the BSD *socket* interface. It is available on all modern Unix systems, Windows, MacOS, OS/2, and probably additional platforms."
  25. msgstr ""
  26. #: ../../library/socket.rst:14
  27. # 718a821c9d5f40348031abc067c5616c
  28. msgid "Some behavior may be platform dependent, since calls are made to the operating system socket APIs."
  29. msgstr ""
  30. #: ../../library/socket.rst:19
  31. # ca7b34c1b7d240388581b066ca7b1a48
  32. msgid "The Python interface is a straightforward transliteration of the Unix system call and library interface for sockets to Python's object-oriented style: the :func:`.socket` function returns a :dfn:`socket object` whose methods implement the various socket system calls. Parameter types are somewhat higher-level than in the C interface: as with :meth:`read` and :meth:`write` operations on Python files, buffer allocation on receive operations is automatic, and buffer length is implicit on send operations."
  33. msgstr ""
  34. #: ../../library/socket.rst:31
  35. # e0c20439c0164148aad4d48a4ca7d254
  36. msgid "Module :mod:`socketserver`"
  37. msgstr ""
  38. #: ../../library/socket.rst:31
  39. # efec016c2eff4baab798422bb99ef14a
  40. msgid "Classes that simplify writing network servers."
  41. msgstr ""
  42. #: ../../library/socket.rst:33
  43. # 989e5cb4de5e4315a9114f887158f0c1
  44. msgid "Module :mod:`ssl`"
  45. msgstr ""
  46. #: ../../library/socket.rst:34
  47. # 6c189024ffc94750bf12dc9d670119e3
  48. msgid "A TLS/SSL wrapper for socket objects."
  49. msgstr ""
  50. #: ../../library/socket.rst:38
  51. # 00a4d609e3e8483da087b231047ed51c
  52. msgid "Socket families"
  53. msgstr ""
  54. #: ../../library/socket.rst:40
  55. # 08f038c8dba14eedb2fcebc97d071090
  56. msgid "Depending on the system and the build options, various socket families are supported by this module."
  57. msgstr ""
  58. #: ../../library/socket.rst:43
  59. # 6addf586f996425cb91b8dea853c5e7c
  60. msgid "The address format required by a particular socket object is automatically selected based on the address family specified when the socket object was created. Socket addresses are represented as follows:"
  61. msgstr ""
  62. #: ../../library/socket.rst:47
  63. # 3fa272622cd04224a788ad32e0fc01c6
  64. msgid "The address of an :const:`AF_UNIX` socket bound to a file system node is represented as a string, using the file system encoding and the ``'surrogateescape'`` error handler (see :pep:`383`). An address in Linux's abstract namespace is returned as a :class:`bytes` object with an initial null byte; note that sockets in this namespace can communicate with normal file system sockets, so programs intended to run on Linux may need to deal with both types of address. A string or :class:`bytes` object can be used for either type of address when passing it as an argument."
  65. msgstr ""
  66. #: ../../library/socket.rst:57
  67. #: ../../library/socket.rst:57
  68. # 9839710817f94ceaaac5863b76436945
  69. # 7bd17ebd489b4cfa9d6c02a271ba933e
  70. msgid "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding."
  71. msgstr ""
  72. #: ../../library/socket.rst:61
  73. # aec6ff2faa6e469cb726b7391dbb22b1
  74. msgid "A pair ``(host, port)`` is used for the :const:`AF_INET` address family, where *host* is a string representing either a hostname in Internet domain notation like ``'daring.cwi.nl'`` or an IPv4 address like ``'100.50.200.5'``, and *port* is an integer."
  75. msgstr ""
  76. #: ../../library/socket.rst:66
  77. # 8b2cdc7122d04792a16dffe89c0077b8
  78. msgid "For :const:`AF_INET6` address family, a four-tuple ``(host, port, flowinfo, scopeid)`` is used, where *flowinfo* and *scopeid* represent the ``sin6_flowinfo`` and ``sin6_scope_id`` members in :const:`struct sockaddr_in6` in C. For :mod:`socket` module methods, *flowinfo* and *scopeid* can be omitted just for backward compatibility. Note, however, omission of *scopeid* can cause problems in manipulating scoped IPv6 addresses."
  79. msgstr ""
  80. #: ../../library/socket.rst:73
  81. # 0e2a1a9ff3f94bc184e4dd65ce0a0cf4
  82. msgid ":const:`AF_NETLINK` sockets are represented as pairs ``(pid, groups)``."
  83. msgstr ""
  84. #: ../../library/socket.rst:75
  85. # 5d42958d185e4699a2671ea9865f37ed
  86. msgid "Linux-only support for TIPC is available using the :const:`AF_TIPC` address family. TIPC is an open, non-IP based networked protocol designed for use in clustered computer environments. Addresses are represented by a tuple, and the fields depend on the address type. The general tuple form is ``(addr_type, v1, v2, v3 [, scope])``, where:"
  87. msgstr ""
  88. #: ../../library/socket.rst:81
  89. # ed9834ecf78143d0bfccee3128289a04
  90. msgid "*addr_type* is one of :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`, or :const:`TIPC_ADDR_ID`."
  91. msgstr ""
  92. #: ../../library/socket.rst:83
  93. # 839d171395dd4e5abec7fa7d19f06416
  94. msgid "*scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`, and :const:`TIPC_NODE_SCOPE`."
  95. msgstr ""
  96. #: ../../library/socket.rst:85
  97. # 7957cc3c432345f18edd34a599d7ccba
  98. msgid "If *addr_type* is :const:`TIPC_ADDR_NAME`, then *v1* is the server type, *v2* is the port identifier, and *v3* should be 0."
  99. msgstr ""
  100. #: ../../library/socket.rst:88
  101. # c903c568e4c743a18376a595f02ada26
  102. msgid "If *addr_type* is :const:`TIPC_ADDR_NAMESEQ`, then *v1* is the server type, *v2* is the lower port number, and *v3* is the upper port number."
  103. msgstr ""
  104. #: ../../library/socket.rst:91
  105. #: ../../library/socket.rst:94
  106. # 66c93722656749978b3884ced870def9
  107. # 3d8854372122489aa178015476388c81
  108. msgid "If *addr_type* is :const:`TIPC_ADDR_ID`, then *v1* is the node, *v2* is the reference, and *v3* should be set to 0."
  109. msgstr ""
  110. #: ../../library/socket.rst:97
  111. # 866f02d98b2d4b86ab8c25706897e5af
  112. msgid "A tuple ``(interface, )`` is used for the :const:`AF_CAN` address family, where *interface* is a string representing a network interface name like ``'can0'``. The network interface name ``''`` can be used to receive packets from all network interfaces of this family."
  113. msgstr ""
  114. #: ../../library/socket.rst:102
  115. # fc3c4663cfb9404eabf6c14fe10f8a5b
  116. msgid "A string or a tuple ``(id, unit)`` is used for the :const:`SYSPROTO_CONTROL` protocol of the :const:`PF_SYSTEM` family. The string is the name of a kernel control using a dynamically-assigned ID. The tuple can be used if ID and unit number of the kernel control are known or if a registered ID is used."
  117. msgstr ""
  118. #: ../../library/socket.rst:110
  119. # 2479e37fd40c408e969e04c6e8e8a6d3
  120. msgid "Certain other address families (:const:`AF_BLUETOOTH`, :const:`AF_PACKET`) support specific representations."
  121. msgstr ""
  122. #: ../../library/socket.rst:115
  123. # 3226490d328442d98e294780fdb05429
  124. msgid "For IPv4 addresses, two special forms are accepted instead of a host address: the empty string represents :const:`INADDR_ANY`, and the string ``'<broadcast>'`` represents :const:`INADDR_BROADCAST`. This behavior is not compatible with IPv6, therefore, you may want to avoid these if you intend to support IPv6 with your Python programs."
  125. msgstr ""
  126. #: ../../library/socket.rst:121
  127. # 0f932973a17e4bafbb65b8560c23553d
  128. msgid "If you use a hostname in the *host* portion of IPv4/v6 socket address, the program may show a nondeterministic behavior, as Python uses the first address returned from the DNS resolution. The socket address will be resolved differently into an actual IPv4/v6 address, depending on the results from DNS resolution and/or the host configuration. For deterministic behavior use a numeric address in *host* portion."
  129. msgstr ""
  130. #: ../../library/socket.rst:128
  131. # 5f5a26b7db4a488d8b94af1ba28b351d
  132. msgid "All errors raise exceptions. The normal exceptions for invalid argument types and out-of-memory conditions can be raised; starting from Python 3.3, errors related to socket or address semantics raise :exc:`OSError` or one of its subclasses (they used to raise :exc:`socket.error`)."
  133. msgstr ""
  134. #: ../../library/socket.rst:133
  135. # c95723e1a2b44d98b69d8d89a621cb21
  136. msgid "Non-blocking mode is supported through :meth:`~socket.setblocking`. A generalization of this based on timeouts is supported through :meth:`~socket.settimeout`."
  137. msgstr ""
  138. #: ../../library/socket.rst:139
  139. # c774f0944c484502bf96c2b5ce07ce68
  140. msgid "Module contents"
  141. msgstr ""
  142. #: ../../library/socket.rst:141
  143. # 7cd19c82a9bb4fe2bd40d368acf19240
  144. msgid "The module :mod:`socket` exports the following elements."
  145. msgstr ""
  146. #: ../../library/socket.rst:145
  147. # 794c39a39a3941119d1c606ae090be58
  148. msgid "Exceptions"
  149. msgstr ""
  150. #: ../../library/socket.rst:149
  151. # c3194afd41c8423bb4d47c74ab0ba35d
  152. msgid "A deprecated alias of :exc:`OSError`."
  153. msgstr ""
  154. #: ../../library/socket.rst:151
  155. #: ../../library/socket.rst:151
  156. # ef4928f7db6c41e78c390b16f15e07a7
  157. # 71118ae47376428ea68fb8120ad9b859
  158. msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`."
  159. msgstr ""
  160. #: ../../library/socket.rst:157
  161. # 3923e5f10d4749e2a7acc71ad543d14a
  162. msgid "A subclass of :exc:`OSError`, this exception is raised for address-related errors, i.e. for functions that use *h_errno* in the POSIX C API, including :func:`gethostbyname_ex` and :func:`gethostbyaddr`. The accompanying value is a pair ``(h_errno, string)`` representing an error returned by a library call. *h_errno* is a numeric value, while *string* represents the description of *h_errno*, as returned by the :c:func:`hstrerror` C function."
  163. msgstr ""
  164. #: ../../library/socket.rst:165
  165. #: ../../library/socket.rst:165
  166. #: ../../library/socket.rst:178
  167. #: ../../library/socket.rst:178
  168. #: ../../library/socket.rst:189
  169. #: ../../library/socket.rst:189
  170. # 4d701008711d49ed86e19fc540460417
  171. # d1ec22a46ee243f9b8111d39c3c1d43e
  172. # e2650f492cb14c8b84978b65ae8f7612
  173. # 0400c4612d67460ab25c7ae831d3aea9
  174. # d8fb49a1279e46f3855348b4ff60dea4
  175. # 02b3273a18384a169b13238f572826cf
  176. msgid "This class was made a subclass of :exc:`OSError`."
  177. msgstr ""
  178. #: ../../library/socket.rst:170
  179. # b0d65754dfcc40c3b80ddb05161881db
  180. msgid "A subclass of :exc:`OSError`, this exception is raised for address-related errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying value is a pair ``(error, string)`` representing an error returned by a library call. *string* represents the description of *error*, as returned by the :c:func:`gai_strerror` C function. The numeric *error* value will match one of the :const:`EAI_\\*` constants defined in this module."
  181. msgstr ""
  182. #: ../../library/socket.rst:183
  183. # 1b58db6b4f21479aa49e62800ec4be1c
  184. msgid "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs on a socket which has had timeouts enabled via a prior call to :meth:`~socket.settimeout` (or implicitly through :func:`~socket.setdefaulttimeout`). The accompanying value is a string whose value is currently always \"timed out\"."
  185. msgstr ""
  186. #: ../../library/socket.rst:194
  187. # 35283adb7130476e834a20e97ad0da33
  188. msgid "Constants"
  189. msgstr ""
  190. #: ../../library/socket.rst:200
  191. # b0a4f1d27da446b48f1fcea348ecbf78
  192. msgid "These constants represent the address (and protocol) families, used for the first argument to :func:`.socket`. If the :const:`AF_UNIX` constant is not defined then this protocol is unsupported. More constants may be available depending on the system."
  193. msgstr ""
  194. #: ../../library/socket.rst:212
  195. # 3e241f0c8fdd4c2bad50d8974eb4a4df
  196. msgid "These constants represent the socket types, used for the second argument to :func:`.socket`. More constants may be available depending on the system. (Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be generally useful.)"
  197. msgstr ""
  198. #: ../../library/socket.rst:220
  199. # d03f8b97cc2c4fb6ba04feef70ccfe61
  200. msgid "These two constants, if defined, can be combined with the socket types and allow you to set some flags atomically (thus avoiding possible race conditions and the need for separate calls)."
  201. msgstr ""
  202. #: ../../library/socket.rst:226
  203. # 3e4f897695cb44978c610ec567f67005
  204. msgid "`Secure File Descriptor Handling <http://udrepper.livejournal.com/20407.html>`_ for a more thorough explanation."
  205. msgstr ""
  206. #: ../../library/socket.rst:229
  207. # 0666bebc969947ac8b299f164398a3c6
  208. msgid "Availability: Linux >= 2.6.27."
  209. msgstr ""
  210. #: ../../library/socket.rst:248
  211. # 9cf14a3caa5c48d3b25208f963ed065a
  212. msgid "Many constants of these forms, documented in the Unix documentation on sockets and/or the IP protocol, are also defined in the socket module. They are generally used in arguments to the :meth:`setsockopt` and :meth:`getsockopt` methods of socket objects. In most cases, only those symbols that are defined in the Unix header files are defined; for a few symbols, default values are provided."
  213. msgstr ""
  214. #: ../../library/socket.rst:260
  215. #: ../../library/socket.rst:273
  216. # a8b7601b2a574d7ba229aa1ca6215fc0
  217. # eb8f2abf858f49178a923f807b693c76
  218. msgid "Many constants of these forms, documented in the Linux documentation, are also defined in the socket module."
  219. msgstr ""
  220. #: ../../library/socket.rst:263
  221. # 4d0156314e434366bb56040b9bc9f745
  222. msgid "Availability: Linux >= 2.6.25."
  223. msgstr ""
  224. #: ../../library/socket.rst:276
  225. # 67717c2e6b6d4b038be2b9a11d90cd81
  226. msgid "Availability: Linux >= 2.6.30."
  227. msgstr ""
  228. #: ../../library/socket.rst:284
  229. # 5331acc939604d8e90d4581ef08eebe7
  230. msgid "Constants for Windows' WSAIoctl(). The constants are used as arguments to the :meth:`~socket.socket.ioctl` method of socket objects."
  231. msgstr ""
  232. #: ../../library/socket.rst:290
  233. # 616e56fdfc4b4448becdf7a72750d6b8
  234. msgid "TIPC related constants, matching the ones exported by the C socket API. See the TIPC documentation for more information."
  235. msgstr ""
  236. #: ../../library/socket.rst:296
  237. # 25af97962a14423a9892e71de631222f
  238. msgid "This constant contains a boolean value which indicates if IPv6 is supported on this platform."
  239. msgstr ""
  240. #: ../../library/socket.rst:301
  241. # 362a45435dec4d58bd5fea524321365c
  242. msgid "Functions"
  243. msgstr ""
  244. #: ../../library/socket.rst:304
  245. # 835ebd3f13df480f89912e958e4d7d81
  246. msgid "Creating sockets"
  247. msgstr ""
  248. #: ../../library/socket.rst:306
  249. # 753ee6a7680b4931ae38bc074cb63167
  250. msgid "The following functions all create :ref:`socket objects <socket-objects>`."
  251. msgstr ""
  252. #: ../../library/socket.rst:311
  253. # 01fd05421dde4008ad2fbe3acd359b22
  254. msgid "Create a new socket using the given address family, socket type and protocol number. The address family should be :const:`AF_INET` (the default), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN` or :const:`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_`` constants. The protocol number is usually zero and may be omitted in that case or :const:`CAN_RAW` in case the address family is :const:`AF_CAN`."
  255. msgstr ""
  256. #: ../../library/socket.rst:319
  257. #: ../../library/socket.rst:319
  258. # 3401694d32bb4f9081d0274ac0c79ac1
  259. # c27cbef8d1094640ac3057b51518b17f
  260. msgid "The AF_CAN family was added. The AF_RDS family was added."
  261. msgstr ""
  262. #: ../../library/socket.rst:326
  263. # 152d725f41544ad6ad60b98bc9b546c3
  264. msgid "Build a pair of connected socket objects using the given address family, socket type, and protocol number. Address family, socket type, and protocol number are as for the :func:`.socket` function above. The default family is :const:`AF_UNIX` if defined on the platform; otherwise, the default is :const:`AF_INET`. Availability: Unix."
  265. msgstr ""
  266. #: ../../library/socket.rst:332
  267. #: ../../library/socket.rst:332
  268. # f043ae2a027d42348c1cf94a789360d1
  269. # 29e4cd5fc3f14c4482de1c86601cbcf3
  270. msgid "The returned socket objects now support the whole socket API, rather than a subset."
  271. msgstr ""
  272. #: ../../library/socket.rst:339
  273. # 449eb6e3756e4738b87c8cbf7e881f9a
  274. msgid "Connect to a TCP service listening on the Internet *address* (a 2-tuple ``(host, port)``), and return the socket object. This is a higher-level function than :meth:`socket.connect`: if *host* is a non-numeric hostname, it will try to resolve it for both :data:`AF_INET` and :data:`AF_INET6`, and then try to connect to all possible addresses in turn until a connection succeeds. This makes it easy to write clients that are compatible to both IPv4 and IPv6."
  275. msgstr ""
  276. #: ../../library/socket.rst:347
  277. # cdb44a8c3cdf4796a12d7b3d187a6eb3
  278. msgid "Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used."
  279. msgstr ""
  280. #: ../../library/socket.rst:352
  281. # dc53c6683e1d4da78e5f7fc3743a78a2
  282. msgid "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the socket to bind to as its source address before connecting. If host or port are '' or 0 respectively the OS default behavior will be used."
  283. msgstr ""
  284. #: ../../library/socket.rst:356
  285. #: ../../library/socket.rst:356
  286. # cb83de96360d4e0c99b8102107afcc2d
  287. # 1819757f05474ac09855e9cd02b8979c
  288. msgid "*source_address* was added."
  289. msgstr ""
  290. #: ../../library/socket.rst:359
  291. #: ../../library/socket.rst:359
  292. # 6c9d7f3f9ade4eeea80dfb149ee622b7
  293. # e130458cea094d21968dc29c97b1a85d
  294. msgid "support for the :keyword:`with` statement was added."
  295. msgstr ""
  296. #: ../../library/socket.rst:365
  297. # d7d789a65eb54041bdbe10afdd39ee16
  298. msgid "Duplicate the file descriptor *fd* (an integer as returned by a file object's :meth:`fileno` method) and build a socket object from the result. Address family, socket type and protocol number are as for the :func:`.socket` function above. The file descriptor should refer to a socket, but this is not checked --- subsequent operations on the object may fail if the file descriptor is invalid. This function is rarely needed, but can be used to get or set socket options on a socket passed to a program as standard input or output (such as a server started by the Unix inet daemon). The socket is assumed to be in blocking mode."
  299. msgstr ""
  300. #: ../../library/socket.rst:377
  301. # ca61177b87d54d7793dfde97f4947a00
  302. msgid "Instantiate a socket from data obtained from the :meth:`socket.share` method. The socket is assumed to be in blocking mode."
  303. msgstr ""
  304. #: ../../library/socket.rst:380
  305. #: ../../library/socket.rst:1138
  306. # 72a929a423ba4193aa0ab137386f501b
  307. # 9844d838e42046658498e904bd7478bb
  308. msgid "Availability: Windows."
  309. msgstr ""
  310. #: ../../library/socket.rst:387
  311. # a4955338259c4563b747e62cf5dbb64c
  312. msgid "This is a Python type object that represents the socket object type. It is the same as ``type(socket(...))``."
  313. msgstr ""
  314. #: ../../library/socket.rst:392
  315. # dbaa8586481843c79efac190a41e8fcd
  316. msgid "Other functions"
  317. msgstr ""
  318. #: ../../library/socket.rst:394
  319. # 64e4d449642c45e991258e31301ccd9f
  320. msgid "The :mod:`socket` module also offers various network-related services:"
  321. msgstr ""
  322. #: ../../library/socket.rst:399
  323. # da95fc2fbc8f4abab60e3b277feef5cd
  324. msgid "Translate the *host*/*port* argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. *host* is a domain name, a string representation of an IPv4/v6 address or ``None``. *port* is a string service name such as ``'http'``, a numeric port number or ``None``. By passing ``None`` as the value of *host* and *port*, you can pass ``NULL`` to the underlying C API."
  325. msgstr ""
  326. #: ../../library/socket.rst:406
  327. # 489143df472e4e859ef3ab7f529b9a80
  328. msgid "The *family*, *type* and *proto* arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. The *flags* argument can be one or several of the ``AI_*`` constants, and will influence how results are computed and returned. For example, :const:`AI_NUMERICHOST` will disable domain name resolution and will raise an error if *host* is a domain name."
  329. msgstr ""
  330. #: ../../library/socket.rst:414
  331. # d1e76ee0fdc14e21b0a6820244e4d0ac
  332. msgid "The function returns a list of 5-tuples with the following structure:"
  333. msgstr ""
  334. #: ../../library/socket.rst:416
  335. # c2118a5739b04e3d9e89ffdf933f848c
  336. msgid "``(family, type, proto, canonname, sockaddr)``"
  337. msgstr ""
  338. #: ../../library/socket.rst:418
  339. # 7febe568470a4942a2c2dd356940b655
  340. msgid "In these tuples, *family*, *type*, *proto* are all integers and are meant to be passed to the :func:`.socket` function. *canonname* will be a string representing the canonical name of the *host* if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be empty. *sockaddr* is a tuple describing a socket address, whose format depends on the returned *family* (a ``(address, port)`` 2-tuple for :const:`AF_INET`, a ``(address, port, flow info, scope id)`` 4-tuple for :const:`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method."
  341. msgstr ""
  342. #: ../../library/socket.rst:428
  343. # be7b0aa0798b4b8da184a7cf9f72232b
  344. msgid "The following example fetches address information for a hypothetical TCP connection to ``www.python.org`` on port 80 (results may differ on your system if IPv6 isn't enabled)::"
  345. msgstr ""
  346. #: ../../library/socket.rst:436
  347. #: ../../library/socket.rst:436
  348. # cb89a38f99fc410d9b8ef7ba3842faf1
  349. # ec16915d80054df3a9785e36eea0046d
  350. msgid "parameters can now be passed as single keyword arguments."
  351. msgstr ""
  352. #: ../../library/socket.rst:441
  353. # 53615f9f9a514d4e91a5a6c4d85de182
  354. msgid "Return a fully qualified domain name for *name*. If *name* is omitted or empty, it is interpreted as the local host. To find the fully qualified name, the hostname returned by :func:`gethostbyaddr` is checked, followed by aliases for the host, if available. The first name which includes a period is selected. In case no fully qualified domain name is available, the hostname as returned by :func:`gethostname` is returned."
  355. msgstr ""
  356. #: ../../library/socket.rst:451
  357. # 0eeaa94d5dd549d0b8488287730b7a36
  358. msgid "Translate a host name to IPv4 address format. The IPv4 address is returned as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 address itself it is returned unchanged. See :func:`gethostbyname_ex` for a more complete interface. :func:`gethostbyname` does not support IPv6 name resolution, and :func:`getaddrinfo` should be used instead for IPv4/v6 dual stack support."
  359. msgstr ""
  360. #: ../../library/socket.rst:460
  361. # dd655c91490845618bfe2a8a55e8b73d
  362. msgid "Translate a host name to IPv4 address format, extended interface. Return a triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the primary host name responding to the given *ip_address*, *aliaslist* is a (possibly empty) list of alternative host names for the same address, and *ipaddrlist* is a list of IPv4 addresses for the same interface on the same host (often but not always a single address). :func:`gethostbyname_ex` does not support IPv6 name resolution, and :func:`getaddrinfo` should be used instead for IPv4/v6 dual stack support."
  363. msgstr ""
  364. #: ../../library/socket.rst:472
  365. # 73e962c3b8a84a1483e8c26d4e210862
  366. msgid "Return a string containing the hostname of the machine where the Python interpreter is currently executing."
  367. msgstr ""
  368. #: ../../library/socket.rst:475
  369. # f9b3d54e89994c15b1eef44bf705b4ba
  370. msgid "If you want to know the current machine's IP address, you may want to use ``gethostbyname(gethostname())``. This operation assumes that there is a valid address-to-host mapping for the host, and the assumption does not always hold."
  371. msgstr ""
  372. #: ../../library/socket.rst:480
  373. # 4ba246d1f849474d86bc633a1da6264e
  374. msgid "Note: :func:`gethostname` doesn't always return the fully qualified domain name; use ``getfqdn()`` (see above)."
  375. msgstr ""
  376. #: ../../library/socket.rst:486
  377. # cc34823a4f2d4e3284258a2109c11cac
  378. msgid "Return a triple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the primary host name responding to the given *ip_address*, *aliaslist* is a (possibly empty) list of alternative host names for the same address, and *ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the same host (most likely containing only a single address). To find the fully qualified domain name, use the function :func:`getfqdn`. :func:`gethostbyaddr` supports both IPv4 and IPv6."
  379. msgstr ""
  380. #: ../../library/socket.rst:497
  381. # 4be3c21ed1bf4d5faec1e42877dd9877
  382. msgid "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. Depending on the settings of *flags*, the result can contain a fully-qualified domain name or numeric address representation in *host*. Similarly, *port* can contain a string port name or a numeric port number."
  383. msgstr ""
  384. #: ../../library/socket.rst:505
  385. # f2b5ad4679104aafb1abe480034a5ed3
  386. msgid "Translate an Internet protocol name (for example, ``'icmp'``) to a constant suitable for passing as the (optional) third argument to the :func:`.socket` function. This is usually only needed for sockets opened in \"raw\" mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol is chosen automatically if the protocol is omitted or zero."
  387. msgstr ""
  388. #: ../../library/socket.rst:514
  389. # 39f75d9eb9264692918f671d6be390ec
  390. msgid "Translate an Internet service name and protocol name to a port number for that service. The optional protocol name, if given, should be ``'tcp'`` or ``'udp'``, otherwise any protocol will match."
  391. msgstr ""
  392. #: ../../library/socket.rst:521
  393. # dfa9f40b690d43d28e0e8c17f46d558d
  394. msgid "Translate an Internet port number and protocol name to a service name for that service. The optional protocol name, if given, should be ``'tcp'`` or ``'udp'``, otherwise any protocol will match."
  395. msgstr ""
  396. #: ../../library/socket.rst:528
  397. # 6feb402444d24f65abaaf1abffed0706
  398. msgid "Convert 32-bit positive integers from network to host byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 4-byte swap operation."
  399. msgstr ""
  400. #: ../../library/socket.rst:535
  401. # 51d2994311c940e98aff17b5e3eceb59
  402. msgid "Convert 16-bit positive integers from network to host byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation."
  403. msgstr ""
  404. #: ../../library/socket.rst:542
  405. # 02fc05e64a7a4e179f851a8cd5551949
  406. msgid "Convert 32-bit positive integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 4-byte swap operation."
  407. msgstr ""
  408. #: ../../library/socket.rst:549
  409. # 2da3fa52c4c844c8989fa36a226813cc
  410. msgid "Convert 16-bit positive integers from host to network byte order. On machines where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation."
  411. msgstr ""
  412. #: ../../library/socket.rst:556
  413. # eb512910712e407581ddf05254dc1a6c
  414. msgid "Convert an IPv4 address from dotted-quad string format (for example, '123.45.67.89') to 32-bit packed binary format, as a bytes object four characters in length. This is useful when conversing with a program that uses the standard C library and needs objects of type :c:type:`struct in_addr`, which is the C type for the 32-bit packed binary this function returns."
  415. msgstr ""
  416. #: ../../library/socket.rst:562
  417. # 77894199ecce4774b800266e819dcff8
  418. msgid ":func:`inet_aton` also accepts strings with less than three dots; see the Unix manual page :manpage:`inet(3)` for details."
  419. msgstr ""
  420. #: ../../library/socket.rst:565
  421. # 13590d08f6b147a9b20216248d62e41b
  422. msgid "If the IPv4 address string passed to this function is invalid, :exc:`OSError` will be raised. Note that exactly what is valid depends on the underlying C implementation of :c:func:`inet_aton`."
  423. msgstr ""
  424. #: ../../library/socket.rst:569
  425. # d7248f6947ed482b8f40956fd03f7bb0
  426. msgid ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be used instead for IPv4/v6 dual stack support."
  427. msgstr ""
  428. #: ../../library/socket.rst:575
  429. # 88f4e89caa4b4927af52a0c7cec1b204
  430. msgid "Convert a 32-bit packed IPv4 address (a bytes object four characters in length) to its standard dotted-quad string representation (for example, '123.45.67.89'). This is useful when conversing with a program that uses the standard C library and needs objects of type :c:type:`struct in_addr`, which is the C type for the 32-bit packed binary data this function takes as an argument."
  431. msgstr ""
  432. #: ../../library/socket.rst:582
  433. # c7a0482928f04d11a6242e3cd1e59210
  434. msgid "If the byte sequence passed to this function is not exactly 4 bytes in length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support IPv6, and :func:`inet_ntop` should be used instead for IPv4/v6 dual stack support."
  435. msgstr ""
  436. #: ../../library/socket.rst:590
  437. # 6a777f795b1b4bd7954cd86b699287f1
  438. msgid "Convert an IP address from its family-specific string format to a packed, binary format. :func:`inet_pton` is useful when a library or network protocol calls for an object of type :c:type:`struct in_addr` (similar to :func:`inet_aton`) or :c:type:`struct in6_addr`."
  439. msgstr ""
  440. #: ../../library/socket.rst:595
  441. # 0c4640629bff48f09f1aa1ca94bf49de
  442. msgid "Supported values for *address_family* are currently :const:`AF_INET` and :const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:`OSError` will be raised. Note that exactly what is valid depends on both the value of *address_family* and the underlying implementation of :c:func:`inet_pton`."
  443. msgstr ""
  444. #: ../../library/socket.rst:601
  445. #: ../../library/socket.rst:617
  446. # f0882252f5a54686a324dba6a32541f9
  447. # 935f331356564bd5a2bbe00d93d55640
  448. msgid "Availability: Unix (maybe not all platforms)."
  449. msgstr ""
  450. #: ../../library/socket.rst:606
  451. # 2f3ee5780b494362bbfcb75f7003955d
  452. msgid "Convert a packed IP address (a bytes object of some number of characters) to its standard, family-specific string representation (for example, ``'7.10.0.5'`` or ``'5aef:2b::8'``). :func:`inet_ntop` is useful when a library or network protocol returns an object of type :c:type:`struct in_addr` (similar to :func:`inet_ntoa`) or :c:type:`struct in6_addr`."
  453. msgstr ""
  454. #: ../../library/socket.rst:612
  455. # 8241745c11774039a84ac2f1ccff07c3
  456. msgid "Supported values for *address_family* are currently :const:`AF_INET` and :const:`AF_INET6`. If the string *packed_ip* is not the correct length for the specified address family, :exc:`ValueError` will be raised. A :exc:`OSError` is raised for errors from the call to :func:`inet_ntop`."
  457. msgstr ""
  458. #: ../../library/socket.rst:628
  459. # a6fe65cc7b674e579c4ed5dfe76e6f32
  460. msgid "Return the total length, without trailing padding, of an ancillary data item with associated data of the given *length*. This value can often be used as the buffer size for :meth:`~socket.recvmsg` to receive a single item of ancillary data, but :rfc:`3542` requires portable applications to use :func:`CMSG_SPACE` and thus include space for padding, even when the item will be the last in the buffer. Raises :exc:`OverflowError` if *length* is outside the permissible range of values."
  461. msgstr ""
  462. #: ../../library/socket.rst:637
  463. #: ../../library/socket.rst:658
  464. #: ../../library/socket.rst:959
  465. #: ../../library/socket.rst:996
  466. #: ../../library/socket.rst:1080
  467. # dcda93aaf72f45678c4eda611aea023d
  468. # 92c323796ea94a588a30005d363bb08b
  469. # eb26b0bbf1d74685a8e1257cee7d0066
  470. # 0747488eeddd4554a4bf6417c57bb72b
  471. # 53eea693d11149469d5673a5fb8ce6c0
  472. msgid "Availability: most Unix platforms, possibly others."
  473. msgstr ""
  474. #: ../../library/socket.rst:644
  475. # 0f01b2f732fe469a8b1ab634e996af97
  476. msgid "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an ancillary data item with associated data of the given *length*, along with any trailing padding. The buffer space needed to receive multiple items is the sum of the :func:`CMSG_SPACE` values for their associated data lengths. Raises :exc:`OverflowError` if *length* is outside the permissible range of values."
  477. msgstr ""
  478. #: ../../library/socket.rst:652
  479. # 79b7af29103f4afdb3e62d6818ad1e2d
  480. msgid "Note that some systems might support ancillary data without providing this function. Also note that setting the buffer size using the results of this function may not precisely limit the amount of ancillary data that can be received, since additional data may be able to fit into the padding area."
  481. msgstr ""
  482. #: ../../library/socket.rst:665
  483. # 7336abb70ff24b9091bf7758b23634d9
  484. msgid "Return the default timeout in seconds (float) for new socket objects. A value of ``None`` indicates that new socket objects have no timeout. When the socket module is first imported, the default is ``None``."
  485. msgstr ""
  486. #: ../../library/socket.rst:672
  487. # 94e8cf3e042246f4a04f0d1456cfc3cd
  488. msgid "Set the default timeout in seconds (float) for new socket objects. When the socket module is first imported, the default is ``None``. See :meth:`~socket.settimeout` for possible values and their respective meanings."
  489. msgstr ""
  490. #: ../../library/socket.rst:680
  491. # 4244f00c68d746358130362fb9c7288b
  492. msgid "Set the machine's hostname to *name*. This will raise a :exc:`OSError` if you don't have enough rights."
  493. msgstr ""
  494. #: ../../library/socket.rst:683
  495. #: ../../library/socket.rst:694
  496. #: ../../library/socket.rst:705
  497. #: ../../library/socket.rst:716
  498. # 7ff272ba99f34ea7abe9a3ca38af8ef0
  499. # 9b5e7820356d43e39df8686108cceab4
  500. # 81051ee7ca9147c8a5598a69608a8ee0
  501. # ec27d109f63d43bfaea94f5ff4095dd2
  502. msgid "Availability: Unix."
  503. msgstr ""
  504. #: ../../library/socket.rst:690
  505. # 499186d8a19e424196679c97e8332bd0
  506. msgid "Return a list of network interface information (index int, name string) tuples. :exc:`OSError` if the system call fails."
  507. msgstr ""
  508. #: ../../library/socket.rst:701
  509. # c4ebcac498a44d64a88b5ee61b65dae1
  510. msgid "Return a network interface index number corresponding to an interface name. :exc:`OSError` if no interface with the given name exists."
  511. msgstr ""
  512. #: ../../library/socket.rst:712
  513. # 8a227c2f2674493aa34f32046016bee1
  514. msgid "Return a network interface name corresponding to a interface index number. :exc:`OSError` if no interface with the given index exists."
  515. msgstr ""
  516. #: ../../library/socket.rst:724
  517. # 11b8514d5b9945a58292ba4d238f92da
  518. msgid "Socket Objects"
  519. msgstr ""
  520. #: ../../library/socket.rst:726
  521. # 313bd9e858854a2f9f183b8cf6f2b2b1
  522. msgid "Socket objects have the following methods. Except for :meth:`~socket.makefile`, these correspond to Unix system calls applicable to sockets."
  523. msgstr ""
  524. #: ../../library/socket.rst:733
  525. # 4030753db7f24dcfaa5c3f54d95b64e7
  526. msgid "Accept a connection. The socket must be bound to an address and listening for connections. The return value is a pair ``(conn, address)`` where *conn* is a *new* socket object usable to send and receive data on the connection, and *address* is the address bound to the socket on the other end of the connection."
  527. msgstr ""
  528. #: ../../library/socket.rst:741
  529. # d64015cae7e2423d926ad0f54eb4e8e6
  530. msgid "Bind the socket to *address*. The socket must not already be bound. (The format of *address* depends on the address family --- see above.)"
  531. msgstr ""
  532. #: ../../library/socket.rst:747
  533. # 0af312f00fa14d46856f5f106c7fc889
  534. msgid "Mark the socket closed. The underlying system resource (e.g. a file descriptor) is also closed when all file objects from :meth:`makefile()` are closed. Once that happens, all future operations on the socket object will fail. The remote end will receive no more data (after queued data is flushed)."
  535. msgstr ""
  536. #: ../../library/socket.rst:753
  537. # c1dcb96692954d88af9f4164f5ab17dd
  538. msgid "Sockets are automatically closed when they are garbage-collected, but it is recommended to :meth:`close` them explicitly, or to use a :keyword:`with` statement around them."
  539. msgstr ""
  540. #: ../../library/socket.rst:758
  541. # 8e55a10cfc0b4eda9e15f598e2b071d8
  542. msgid ":meth:`close()` releases the resource associated with a connection but does not necessarily close the connection immediately. If you want to close the connection in a timely fashion, call :meth:`shutdown()` before :meth:`close()`."
  543. msgstr ""
  544. #: ../../library/socket.rst:766
  545. # 13f2a08413d14fe59c1f42cd9273eb48
  546. msgid "Connect to a remote socket at *address*. (The format of *address* depends on the address family --- see above.)"
  547. msgstr ""
  548. #: ../../library/socket.rst:772
  549. # 82a7a5b413ea4b0a97175133f1e3f216
  550. msgid "Like ``connect(address)``, but return an error indicator instead of raising an exception for errors returned by the C-level :c:func:`connect` call (other problems, such as \"host not found,\" can still raise exceptions). The error indicator is ``0`` if the operation succeeded, otherwise the value of the :c:data:`errno` variable. This is useful to support, for example, asynchronous connects."
  551. msgstr ""
  552. #: ../../library/socket.rst:782
  553. # ff02c80cdc4a4c95bee3265b763f0fff
  554. msgid "Put the socket object into closed state without actually closing the underlying file descriptor. The file descriptor is returned, and can be reused for other purposes."
  555. msgstr ""
  556. #: ../../library/socket.rst:791
  557. # 8b867688b5aa4a2c96070cf7f36b2c58
  558. msgid "Return the socket's file descriptor (a small integer). This is useful with :func:`select.select`."
  559. msgstr ""
  560. #: ../../library/socket.rst:794
  561. # 2fe6d2fd6a08493c99a03a2ea0a88f75
  562. msgid "Under Windows the small integer returned by this method cannot be used where a file descriptor can be used (such as :func:`os.fdopen`). Unix does not have this limitation."
  563. msgstr ""
  564. #: ../../library/socket.rst:801
  565. # b9877063f0fb4d909eafa1ffae517edb
  566. msgid "Return the remote address to which the socket is connected. This is useful to find out the port number of a remote IPv4/v6 socket, for instance. (The format of the address returned depends on the address family --- see above.) On some systems this function is not supported."
  567. msgstr ""
  568. #: ../../library/socket.rst:809
  569. # 89287c66e835478180c05d27af2b68da
  570. msgid "Return the socket's own address. This is useful to find out the port number of an IPv4/v6 socket, for instance. (The format of the address returned depends on the address family --- see above.)"
  571. msgstr ""
  572. #: ../../library/socket.rst:816
  573. # 62d1a36b7cde46efb1cf2b29567f232b
  574. msgid "Return the value of the given socket option (see the Unix man page :manpage:`getsockopt(2)`). The needed symbolic constants (:const:`SO_\\*` etc.) are defined in this module. If *buflen* is absent, an integer option is assumed and its integer value is returned by the function. If *buflen* is present, it specifies the maximum length of the buffer used to receive the option in, and this buffer is returned as a bytes object. It is up to the caller to decode the contents of the buffer (see the optional built-in module :mod:`struct` for a way to decode C structures encoded as byte strings)."
  575. msgstr ""
  576. #: ../../library/socket.rst:828
  577. # b8ec909496b94c138472500bc131d5ad
  578. msgid "Return the timeout in seconds (float) associated with socket operations, or ``None`` if no timeout is set. This reflects the last call to :meth:`setblocking` or :meth:`settimeout`."
  579. msgstr ""
  580. #: ../../library/socket.rst:835
  581. # 41b163af889b42239d009ed83709675f
  582. msgid "Windows"
  583. msgstr ""
  584. #: ../../library/socket.rst:837
  585. # 04d06913140945bd8d93157b0e7c3ccd
  586. msgid "The :meth:`ioctl` method is a limited interface to the WSAIoctl system interface. Please refer to the `Win32 documentation <http://msdn.microsoft.com/en-us/library/ms741621%28VS.85%29.aspx>`_ for more information."
  587. msgstr ""
  588. #: ../../library/socket.rst:842
  589. # 7a70db30b7b9461688295ab94800240a
  590. msgid "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` functions may be used; they accept a socket object as their first argument."
  591. msgstr ""
  592. #: ../../library/socket.rst:847
  593. # d42450bce7844b2d94d4be07dab670fb
  594. msgid "Listen for connections made to the socket. The *backlog* argument specifies the maximum number of queued connections and should be at least 0; the maximum value is system-dependent (usually 5), the minimum value is forced to 0."
  595. msgstr ""
  596. #: ../../library/socket.rst:857
  597. # 9b5f4c10ac4a46879b3b1d300ec5fbe4
  598. msgid "Return a :term:`file object` associated with the socket. The exact returned type depends on the arguments given to :meth:`makefile`. These arguments are interpreted the same way as by the built-in :func:`open` function."
  599. msgstr ""
  600. #: ../../library/socket.rst:861
  601. # 69d19d0595284b179729781630dbe4a2
  602. msgid "The socket must be in blocking mode; it can have a timeout, but the file object's internal buffer may end up in a inconsistent state if a timeout occurs."
  603. msgstr ""
  604. #: ../../library/socket.rst:865
  605. # da3712a18bf74483aedfc59cc32e3a77
  606. msgid "Closing the file object returned by :meth:`makefile` won't close the original socket unless all other file objects have been closed and :meth:`socket.close` has been called on the socket object."
  607. msgstr ""
  608. #: ../../library/socket.rst:871
  609. # 0db155f75b034bc3a62f246f3a108881
  610. msgid "On Windows, the file-like object created by :meth:`makefile` cannot be used where a file object with a file descriptor is expected, such as the stream arguments of :meth:`subprocess.Popen`."
  611. msgstr ""
  612. #: ../../library/socket.rst:878
  613. # d7385b182ced46be8ed5914f186a11c2
  614. msgid "Receive data from the socket. The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by *bufsize*. See the Unix manual page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it defaults to zero."
  615. msgstr ""
  616. #: ../../library/socket.rst:885
  617. # 3a21a12c1d6b4bef949750bb63ed4d76
  618. msgid "For best match with hardware and network realities, the value of *bufsize* should be a relatively small power of 2, for example, 4096."
  619. msgstr ""
  620. #: ../../library/socket.rst:891
  621. # 2147fdb7cd1e4c1f8b71739b40dc3e4f
  622. msgid "Receive data from the socket. The return value is a pair ``(bytes, address)`` where *bytes* is a bytes object representing the data received and *address* is the address of the socket sending the data. See the Unix manual page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it defaults to zero. (The format of *address* depends on the address family --- see above.)"
  623. msgstr ""
  624. #: ../../library/socket.rst:900
  625. # 6306a7f1169e464bb895df3d2b489a22
  626. msgid "Receive normal data (up to *bufsize* bytes) and ancillary data from the socket. The *ancbufsize* argument sets the size in bytes of the internal buffer used to receive the ancillary data; it defaults to 0, meaning that no ancillary data will be received. Appropriate buffer sizes for ancillary data can be calculated using :func:`CMSG_SPACE` or :func:`CMSG_LEN`, and items which do not fit into the buffer might be truncated or discarded. The *flags* argument defaults to 0 and has the same meaning as for :meth:`recv`."
  627. msgstr ""
  628. #: ../../library/socket.rst:910
  629. # 29b9c5ed6e0643329761fa30d09e63a7
  630. msgid "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The *data* item is a :class:`bytes` object holding the non-ancillary data received. The *ancdata* item is a list of zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)`` representing the ancillary data (control messages) received: *cmsg_level* and *cmsg_type* are integers specifying the protocol level and protocol-specific type respectively, and *cmsg_data* is a :class:`bytes` object holding the associated data. The *msg_flags* item is the bitwise OR of various flags indicating conditions on the received message; see your system documentation for details. If the receiving socket is unconnected, *address* is the address of the sending socket, if available; otherwise, its value is unspecified."
  631. msgstr ""
  632. #: ../../library/socket.rst:924
  633. # 83ccaf03fd4e4b92a801154e5a6edec2
  634. msgid "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass file descriptors between processes over an :const:`AF_UNIX` socket. When this facility is used (it is often restricted to :const:`SOCK_STREAM` sockets), :meth:`recvmsg` will return, in its ancillary data, items of the form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is a :class:`bytes` object representing the new file descriptors as a binary array of the native C :c:type:`int` type. If :meth:`recvmsg` raises an exception after the system call returns, it will first attempt to close any file descriptors received via this mechanism."
  635. msgstr ""
  636. #: ../../library/socket.rst:935
  637. # bb2310be58de456f8237f2c1be1dd110
  638. msgid "Some systems do not indicate the truncated length of ancillary data items which have been only partially received. If an item appears to extend beyond the end of the buffer, :meth:`recvmsg` will issue a :exc:`RuntimeWarning`, and will return the part of it which is inside the buffer provided it has not been truncated before the start of its associated data."
  639. msgstr ""
  640. #: ../../library/socket.rst:942
  641. # a324dc99a25a4559b7da26b6d8201c70
  642. msgid "On systems which support the :const:`SCM_RIGHTS` mechanism, the following function will receive up to *maxfds* file descriptors, returning the message data and a list containing the descriptors (while ignoring unexpected conditions such as unrelated control messages being received). See also :meth:`sendmsg`. ::"
  643. msgstr ""
  644. #: ../../library/socket.rst:966
  645. # 79276ab1c2d546b0aa1221553610b4c9
  646. msgid "Receive normal data and ancillary data from the socket, behaving as :meth:`recvmsg` would, but scatter the non-ancillary data into a series of buffers instead of returning a new bytes object. The *buffers* argument must be an iterable of objects that export writable buffers (e.g. :class:`bytearray` objects); these will be filled with successive chunks of the non-ancillary data until it has all been written or there are no more buffers. The operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) on the number of buffers that can be used. The *ancbufsize* and *flags* arguments have the same meaning as for :meth:`recvmsg`."
  647. msgstr ""
  648. #: ../../library/socket.rst:977
  649. # e4c9a4057493418192eea01d2b0e2d27
  650. msgid "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, where *nbytes* is the total number of bytes of non-ancillary data written into the buffers, and *ancdata*, *msg_flags* and *address* are the same as for :meth:`recvmsg`."
  651. msgstr ""
  652. #: ../../library/socket.rst:982
  653. # 33927a201c834cf28ad364a61ed77688
  654. msgid "Example::"
  655. msgstr ""
  656. #: ../../library/socket.rst:1003
  657. # d2f9afbd5da8450ba447c4d7e8b89d25
  658. msgid "Receive data from the socket, writing it into *buffer* instead of creating a new bytestring. The return value is a pair ``(nbytes, address)`` where *nbytes* is the number of bytes received and *address* is the address of the socket sending the data. See the Unix manual page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it defaults to zero. (The format of *address* depends on the address family --- see above.)"
  659. msgstr ""
  660. #: ../../library/socket.rst:1013
  661. # 9ca864b9a4674e5e8964b3f93d948a24
  662. msgid "Receive up to *nbytes* bytes from the socket, storing the data into a buffer rather than creating a new bytestring. If *nbytes* is not specified (or 0), receive up to the size available in the given buffer. Returns the number of bytes received. See the Unix manual page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it defaults to zero."
  663. msgstr ""
  664. #: ../../library/socket.rst:1022
  665. # d3ed2dbaf81c42a79db2fa782c446da8
  666. msgid "Send data to the socket. The socket must be connected to a remote socket. The optional *flags* argument has the same meaning as for :meth:`recv` above. Returns the number of bytes sent. Applications are responsible for checking that all data has been sent; if only some of the data was transmitted, the application needs to attempt delivery of the remaining data. For further information on this topic, consult the :ref:`socket-howto`."
  667. msgstr ""
  668. #: ../../library/socket.rst:1032
  669. # f9c12d1cd4fc4149b84d555b22a7050c
  670. msgid "Send data to the socket. The socket must be connected to a remote socket. The optional *flags* argument has the same meaning as for :meth:`recv` above. Unlike :meth:`send`, this method continues to send data from *bytes* until either all data has been sent or an error occurs. ``None`` is returned on success. On error, an exception is raised, and there is no way to determine how much data, if any, was successfully sent."
  671. msgstr ""
  672. #: ../../library/socket.rst:1043
  673. # 467bf26a65a34f7aad2870bdd916c8eb
  674. msgid "Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by *address*. The optional *flags* argument has the same meaning as for :meth:`recv` above. Return the number of bytes sent. (The format of *address* depends on the address family --- see above.)"
  675. msgstr ""
  676. #: ../../library/socket.rst:1052
  677. # 5c2bcc9768e8450bbba4e373c8be834f
  678. msgid "Send normal and ancillary data to the socket, gathering the non-ancillary data from a series of buffers and concatenating it into a single message. The *buffers* argument specifies the non-ancillary data as an iterable of buffer-compatible objects (e.g. :class:`bytes` objects); the operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) on the number of buffers that can be used. The *ancdata* argument specifies the ancillary data (control messages) as an iterable of zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)``, where *cmsg_level* and *cmsg_type* are integers specifying the protocol level and protocol-specific type respectively, and *cmsg_data* is a buffer-compatible object holding the associated data. Note that some systems (in particular, systems without :func:`CMSG_SPACE`) might support sending only one control message per call. The *flags* argument defaults to 0 and has the same meaning as for :meth:`send`. If *address* is supplied and not ``None``, it sets a destination address for the message. The return value is the number of bytes of non-ancillary data sent."
  679. msgstr ""
  680. #: ../../library/socket.rst:1071
  681. # e1851ea974b64c39b9135769441f97d2
  682. msgid "The following function sends the list of file descriptors *fds* over an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` mechanism. See also :meth:`recvmsg`. ::"
  683. msgstr ""
  684. #: ../../library/socket.rst:1087
  685. # d2c42579ecbc41898c3be9ace4ce04c1
  686. msgid "Set blocking or non-blocking mode of the socket: if *flag* is false, the socket is set to non-blocking, else to blocking mode."
  687. msgstr ""
  688. #: ../../library/socket.rst:1090
  689. # 575863e0b86f4a3cbdcec78652ffb45d
  690. msgid "This method is a shorthand for certain :meth:`~socket.settimeout` calls:"
  691. msgstr ""
  692. #: ../../library/socket.rst:1092
  693. # 5db3bddc0c0a4dab8e78f620c999084b
  694. msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``"
  695. msgstr ""
  696. #: ../../library/socket.rst:1094
  697. # cd9df25ff0274674b65422d1f3384dc3
  698. msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``"
  699. msgstr ""
  700. #: ../../library/socket.rst:1099
  701. # 5ef926d9c4784146aa229faf9c0486d8
  702. msgid "Set a timeout on blocking socket operations. The *value* argument can be a nonnegative floating point number expressing seconds, or ``None``. If a non-zero value is given, subsequent socket operations will raise a :exc:`timeout` exception if the timeout period *value* has elapsed before the operation has completed. If zero is given, the socket is put in non-blocking mode. If ``None`` is given, the socket is put in blocking mode."
  703. msgstr ""
  704. #: ../../library/socket.rst:1106
  705. # b520f65855da45aeb2b185429172fa66
  706. msgid "For further information, please consult the :ref:`notes on socket timeouts <socket-timeouts>`."
  707. msgstr ""
  708. #: ../../library/socket.rst:1113
  709. # fd824c4ca65d49bba88f60decd8e8a8b
  710. msgid "Set the value of the given socket option (see the Unix manual page :manpage:`setsockopt(2)`). The needed symbolic constants are defined in the :mod:`socket` module (:const:`SO_\\*` etc.). The value can be an integer or a bytes object representing a buffer. In the latter case it is up to the caller to ensure that the bytestring contains the proper bits (see the optional built-in module :mod:`struct` for a way to encode C structures as bytestrings)."
  711. msgstr ""
  712. #: ../../library/socket.rst:1123
  713. # 0937f0d6a4754f0f97db2291342d9ebc
  714. msgid "Shut down one or both halves of the connection. If *how* is :const:`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends and receives are disallowed."
  715. msgstr ""
  716. #: ../../library/socket.rst:1131
  717. # 39dd6776bcc544ec945df03038704fc4
  718. msgid "Duplicate a socket and prepare it for sharing with a target process. The target process must be provided with *process_id*. The resulting bytes object can then be passed to the target process using some form of interprocess communication and the socket can be recreated there using :func:`fromshare`. Once this method has been called, it is safe to close the socket since the operating system has already duplicated it for the target process."
  719. msgstr ""
  720. #: ../../library/socket.rst:1143
  721. # 29f21a711c074212afd8592f8379d7e0
  722. msgid "Note that there are no methods :meth:`read` or :meth:`write`; use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead."
  723. msgstr ""
  724. #: ../../library/socket.rst:1146
  725. # 32f731f8661046c0bcd56a8eaaf09c8c
  726. msgid "Socket objects also have these (read-only) attributes that correspond to the values given to the :class:`socket` constructor."
  727. msgstr ""
  728. #: ../../library/socket.rst:1152
  729. # d55d380ed12543c9b6e89d30931514cd
  730. msgid "The socket family."
  731. msgstr ""
  732. #: ../../library/socket.rst:1157
  733. # 3f4fd6cd9af5466f9c57822577d2449f
  734. msgid "The socket type."
  735. msgstr ""
  736. #: ../../library/socket.rst:1162
  737. # 89c9509ebd5d4c91915d57b3b80ade6f
  738. msgid "The socket protocol."
  739. msgstr ""
  740. #: ../../library/socket.rst:1169
  741. # 52a1b5c265034739b2abbeb209347740
  742. msgid "Notes on socket timeouts"
  743. msgstr ""
  744. #: ../../library/socket.rst:1171
  745. # d03f86ba105946fd9504c7ecba78216f
  746. msgid "A socket object can be in one of three modes: blocking, non-blocking, or timeout. Sockets are by default always created in blocking mode, but this can be changed by calling :func:`setdefaulttimeout`."
  747. msgstr ""
  748. #: ../../library/socket.rst:1175
  749. # 695d3c8abdef4543af329b643953866d
  750. msgid "In *blocking mode*, operations block until complete or the system returns an error (such as connection timed out)."
  751. msgstr ""
  752. #: ../../library/socket.rst:1178
  753. # 36117dce2eba4f0193eae2ea1ed95a25
  754. msgid "In *non-blocking mode*, operations fail (with an error that is unfortunately system-dependent) if they cannot be completed immediately: functions from the :mod:`select` can be used to know when and whether a socket is available for reading or writing."
  755. msgstr ""
  756. #: ../../library/socket.rst:1183
  757. # 170c44c71ac84faf872b1c8b0e0f4049
  758. msgid "In *timeout mode*, operations fail if they cannot be completed within the timeout specified for the socket (they raise a :exc:`timeout` exception) or if the system returns an error."
  759. msgstr ""
  760. #: ../../library/socket.rst:1188
  761. # ca0939fe859544f5ac8298982a9ba395
  762. msgid "At the operating system level, sockets in *timeout mode* are internally set in non-blocking mode. Also, the blocking and timeout modes are shared between file descriptors and socket objects that refer to the same network endpoint. This implementation detail can have visible consequences if e.g. you decide to use the :meth:`~socket.fileno()` of a socket."
  763. msgstr ""
  764. #: ../../library/socket.rst:1195
  765. # 00f3a4c1fb434937bcea241ccba1541f
  766. msgid "Timeouts and the ``connect`` method"
  767. msgstr ""
  768. #: ../../library/socket.rst:1197
  769. # aef299ca42974a088811e47be15840e5
  770. msgid "The :meth:`~socket.connect` operation is also subject to the timeout setting, and in general it is recommended to call :meth:`~socket.settimeout` before calling :meth:`~socket.connect` or pass a timeout parameter to :meth:`create_connection`. However, the system network stack may also return a connection timeout error of its own regardless of any Python socket timeout setting."
  771. msgstr ""
  772. #: ../../library/socket.rst:1205
  773. # dc8099e289d34b8199e62c3cefef2520
  774. msgid "Timeouts and the ``accept`` method"
  775. msgstr ""
  776. #: ../../library/socket.rst:1207
  777. # dcc43c90abea426eb8374aefae6988f7
  778. msgid "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour depends on settings of the listening socket:"
  779. msgstr ""
  780. #: ../../library/socket.rst:1211
  781. # 807d8dda3e4e4b788c2c3e88fa0a98b3
  782. msgid "if the listening socket is in *blocking mode* or in *timeout mode*, the socket returned by :meth:`~socket.accept` is in *blocking mode*;"
  783. msgstr ""
  784. #: ../../library/socket.rst:1214
  785. # d3db6b8d6c7841e4b10d38c404c869f5
  786. msgid "if the listening socket is in *non-blocking mode*, whether the socket returned by :meth:`~socket.accept` is in blocking or non-blocking mode is operating system-dependent. If you want to ensure cross-platform behaviour, it is recommended you manually override this setting."
  787. msgstr ""
  788. #: ../../library/socket.rst:1223
  789. # 84aabc75cc6a4cab8c61a386e3dcae35
  790. msgid "Example"
  791. msgstr ""
  792. #: ../../library/socket.rst:1225
  793. # 335e390652a7407ca39d296b6a594d16
  794. msgid "Here are four minimal example programs using the TCP/IP protocol: a server that echoes all data that it receives back (servicing only one client), and a client using it. Note that a server must perform the sequence :func:`.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` (possibly repeating the :meth:`~socket.accept` to service more than one client), while a client only needs the sequence :func:`.socket`, :meth:`~socket.connect`. Also note that the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but on the new socket returned by :meth:`~socket.accept`."
  795. msgstr ""
  796. #: ../../library/socket.rst:1235
  797. # 2edf75dcf9d244af88fe46207f802bd9
  798. msgid "The first two examples support IPv4 only. ::"
  799. msgstr ""
  800. #: ../../library/socket.rst:1267
  801. # b66148a82efb4aeca21c6527f1390399
  802. msgid "The next two examples are identical to the above two, but support both IPv4 and IPv6. The server side will listen to the first address family available (it should listen to both instead). On most of IPv6-ready systems, IPv6 will take precedence and the server may not accept IPv4 traffic. The client side will try to connect to the all addresses returned as a result of the name resolution, and sends traffic to the first one connected successfully. ::"
  803. msgstr ""
  804. #: ../../library/socket.rst:1340
  805. # b0cdfc0b7c40457f95af07b394bcb4d8
  806. msgid "The next example shows how to write a very simple network sniffer with raw sockets on Windows. The example requires administrator privileges to modify the interface::"
  807. msgstr ""
  808. #: ../../library/socket.rst:1365
  809. # c2b3e045c6464ebfb4f103ef699952b8
  810. msgid "The last example shows how to use the socket interface to communicate to a CAN network. This example might require special priviledge::"
  811. msgstr ""
  812. #: ../../library/socket.rst:1406
  813. # fa76f50bc11e422593226d00627f27ce
  814. msgid "Running an example several times with too small delay between executions, could lead to this error::"
  815. msgstr ""
  816. #: ../../library/socket.rst:1411
  817. # fe56c8172afc41a0817bc99267597ad9
  818. msgid "This is because the previous execution has left the socket in a ``TIME_WAIT`` state, and can't be immediately reused."
  819. msgstr ""
  820. #: ../../library/socket.rst:1414
  821. # a2d9c7600a244d8aaffafc7c7bd5217e
  822. msgid "There is a :mod:`socket` flag to set, in order to prevent this, :data:`socket.SO_REUSEADDR`::"
  823. msgstr ""
  824. #: ../../library/socket.rst:1421
  825. # 933f558c6ff641b9a1f38813d975b18f
  826. msgid "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in ``TIME_WAIT`` state, without waiting for its natural timeout to expire."
  827. msgstr ""
  828. #: ../../library/socket.rst:1427
  829. # 47e84bd43cfb4f46b01e004d084eb905
  830. msgid "For an introduction to socket programming (in C), see the following papers:"
  831. msgstr ""
  832. #: ../../library/socket.rst:1429
  833. # beda6c0761884fc28d70959a34badd00
  834. msgid "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart Sechrest"
  835. msgstr ""
  836. #: ../../library/socket.rst:1431
  837. # fe182eeff6b14fc5b11c6727cefb3820
  838. msgid "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. Leffler et al,"
  839. msgstr ""
  840. #: ../../library/socket.rst:1434
  841. # 31b716f717d348acac29f666207a0bdb
  842. msgid "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections PS1:7 and PS1:8). The platform-specific reference material for the various socket-related system calls are also a valuable source of information on the details of socket semantics. For Unix, refer to the manual pages; for Windows, see the WinSock (or Winsock 2) specification. For IPv6-ready APIs, readers may want to refer to :rfc:`3493` titled Basic Socket Interface Extensions for IPv6."
  843. msgstr ""
  844. #: ../../library/socket.rst:17
  845. # 14e893c234044918a605d0f03c4170c9
  846. msgid "socket"
  847. msgstr ""
  848. #: ../../library/socket.rst:855
  849. # 461f58032f504769b6ed691559e20b65
  850. msgid "I/O control"
  851. msgstr ""
  852. #: ../../library/socket.rst:855
  853. # 461f58032f504769b6ed691559e20b65
  854. msgid "buffering"
  855. msgstr ""
  856. #: ../../library/socket.rst:1111
  857. # 72aef4ef3af14c299956028aa524fb95
  858. msgid "struct"
  859. msgstr ""