Advertisement
robertbira

Italian Translation Report: Node.js [Part 47 - 1208 words]

Oct 21st, 2018
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.12 KB | None | 0 0
  1. Sets or clears the socket option.
  2. When set to, UDP packets may be sent to a local interface's broadcast address.
  3. Note: All references to scope in this section are referring to IPv6 Zone Indices, which are defined by
  4. In string form, an IP with a scope index is written as where scope is an interface name or interface number.
  5. Sets the default outgoing multicast interface of the socket to a chosen interface or back to system interface selection.
  6. The must be a valid string representation of an IP from the socket's family.
  7. For IPv4 sockets, this should be the IP configured for the desired physical interface. All packets sent to multicast on the socket will be sent on the interface determined by the most recent successful use of this call.
  8. For IPv6 sockets, should include a scope to indicate the interface as in the examples that follow.
  9. In IPv6, individual calls can also use explicit scope in addresses, so only packets sent to a multicast address without specifying an explicit scope are affected by the most recent successful use of this call.
  10. On most systems, where scope format uses the interface name:
  11. On Windows, where scope format uses an interface number:
  12. All systems use an IP of the host on the desired physical interface:
  13. A call on a socket that is not ready to send or no longer open may throw a Not running
  14. If can not be parsed into an IP then an is thrown.
  15. On IPv4, if is a valid address but does not match any interface, or if the address does not match the family then a such as or is thrown.
  16. On IPv6, most errors with specifying or omitting scope will result in the socket continuing to use (or returning to) the system's default interface selection.
  17. A socket's address family's ANY address can be used to return control of the sockets default outgoing interface to the system for future multicast packets.
  18. When set to multicast packets will also be received on the local interface.
  19. While TTL generally stands for "Time to Live", in this context it specifies the number of IP hops that a packet is allowed to travel through, specifically for multicast traffic. Each router or gateway that forwards a packet decrements the TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
  20. The argument passed to is a number of hops between 0 and 255.
  21. The default on most systems is but can vary.
  22. Sets the maximum socket receive buffer in bytes.
  23. Each router or gateway that forwards a packet decrements the TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. Changing TTL values is typically done for network probes or when multicasting.
  24. By default, binding a socket will cause it to block the Node.js process from exiting as long as the socket is open.
  25. The method can be used to exclude the socket from the reference counting that keeps the Node.js process active, allowing the process to exit even if the socket is still listening.
  26. Calling multiple times will have no addition effect.
  27. The method returns a reference to the socket so calls can be chained.
  28. Change to asynchronous behavior
  29. As of Node.js v0.10, changed to an asynchronous execution model.
  30. Legacy code that assumes synchronous behavior, as in the following example:
  31. Must be changed to pass a callback function to the function:
  32. module functions
  33. Available options are:
  34. When will reuse the address, even if another process has already bound a socket on it.
  35. Sets the socket value.
  36. Custom lookup function.
  37. Attached as a listener for events.
  38. Creates a object.
  39. Once the socket is created, calling will instruct the socket to begin listening for datagram messages.
  40. When and are not passed to the method will bind the socket to the "all interfaces" address on a random port (it does the right thing for both and sockets).
  41. The bound address and port can be retrieved using and
  42. An optional function can be passed which is added as a listener for events.
  43. About this Documentation
  44. The goal of this documentation is to comprehensively explain the Node.js API, both from a reference as well as a conceptual point of view. Each section describes a built-in module or high-level concept.
  45. Where appropriate, property types, method arguments, and the arguments provided to event handlers are detailed in a list underneath the topic heading.
  46. Contributing
  47. If errors are found in this documentation, please submit an issue or see the contributing guide for directions on how to submit a patch.
  48. Every file is generated based on the corresponding file in the folder in Node.js's source tree.
  49. The documentation is generated using the program.
  50. An HTML template is located at
  51. Stability Index
  52. Throughout the documentation are indications of a section's stability. The Node.js API is still somewhat changing, and as it matures, certain parts are more reliable than others. Some are so proven, and so relied upon, that they are unlikely to ever change at all. Others are brand new and experimental, or known to be hazardous and in the process of being redesigned.
  53. The stability indices are as follows:
  54. Stability: 0 - Deprecated. This feature is known to be problematic, and changes may be planned. Do not rely on it. Use of the feature may cause warnings to be emitted. Backwards compatibility across major versions should not be expected.
  55. Stability: 1 - Experimental. This feature is still under active development and subject to non-backwards compatible changes, or even removal, in any future version. Use of the feature is not recommended in production environments. Experimental features are not subject to the Node.js Semantic Versioning model.
  56. Stability: 2 - Stable. The API has proven satisfactory. Compatibility with the npm ecosystem is a high priority, and will not be broken unless absolutely necessary.
  57. Caution must be used when making use of features, particularly within modules that may be used as dependencies (or dependencies of dependencies) within a Node.js application.
  58. End users may not be aware that experimental features are being used, and therefore may experience unexpected failures or behavior changes when API modifications occur.
  59. To help avoid such surprises, features may require a command-line flag to explicitly enable them, or may cause a process warning to be emitted.
  60. By default, such warnings are printed to and may be handled by attaching a listener to the event.
  61. Every document has a corresponding document presenting the same information in a structured manner.
  62. This feature is experimental, and added for the benefit of IDEs and other utilities that wish to do programmatic things with the documentation.
  63. Syscalls and man pages
  64. System calls like and define the interface between user programs and the underlying operating system.
  65. Node.js functions which simply wrap a syscall, like, will document that.
  66. The docs link to the corresponding man pages (short for manual pages) which describe how the syscalls work.
  67. Some syscalls, like, are BSD-specific.
  68. That means, for example, that only works on macOS and other BSD-derived systems, and is not available on Linux.
  69. Most Unix syscalls have Windows equivalents, but behavior may differ on Windows relative to Linux and macOS.
  70. For an example of the subtle ways in which it's sometimes impossible to replace Unix syscall semantics on Windows, see
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement