Skip to content

Commit

Permalink
Updates dgram/socket_setmulticastloopback_flag.md
Browse files Browse the repository at this point in the history
Auto commit by GitBook Editor
  • Loading branch information
yjhmelody committed Apr 18, 2017
1 parent 748621c commit b1b01bc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
9 changes: 5 additions & 4 deletions dgram/change_to_asynchronous_socket_bind_behavior.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

As of Node.js v0.10, [`dgram.Socket#bind()`][] changed to an asynchronous
execution model. Legacy code that assumes synchronous behavior, as in the
As of Node.js v0.10, \[`dgram.Socket#bind()`\]\[\] changed to an asynchronous
execution model. Legacy code that assumes synchronous behavior, as in the
following example:

```js
Expand All @@ -9,7 +8,7 @@ s.bind(1234);
s.addMembership('224.0.0.114');
```

Must be changed to pass a callback function to the [`dgram.Socket#bind()`][]
Must be changed to pass a callback function to the \[`dgram.Socket#bind()`\]\[\]
function:

```js
Expand All @@ -19,3 +18,5 @@ s.bind(1234, () => {
});
```



2 changes: 0 additions & 2 deletions dgram/event_close.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
added: v0.1.99
-->

The `'close'` event is emitted after a socket is closed with [`close()`][].
Once triggered, no new `'message'` events will be emitted on this socket.
`'close'`事件将在使用[`close()`][]关闭一个 socket 之后触发。该事件一旦触发,这个 socket 上将不会触发新的`'message'`事件。

4 changes: 2 additions & 2 deletions dgram/event_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ added: v0.1.99
当有新的数据包被 socket 接收时,`'message'`事件会被触发。`msg``rinfo`会作为参数传递到该事件的处理函数中。
* `msg` {Buffer} - 消息
* `rinfo` {Object} - 远程地址信息
* `address` {String} The sender address
* `family` {String} The address family (`'IPv4'` or `'IPv6'`)
* `address` {String} 发送方地址
* `family` {String} 地址类型 (`'IPv4'` or `'IPv6'`)
* `port` {Number} The sender port
* `size` {Number} The message size

4 changes: 2 additions & 2 deletions dgram/socket_bind_port_address_callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ added: v0.1.99
-->

* `port` {Number} - 整数,可选的
* `address` {String}, 可选的
* `callback` {Function} (没有参数),可选的。当绑定完成时会被调用。
* `address` {String} - 可选的
* `callback` {Function} - (没有参数),可选的。当绑定完成时会被调用。

对于 UDP socket,该方法会令`dgram.Socket`在指定的`port`和可选的`address`上监听数据包信息。若`port`未指定或为 `0`,操作系统会尝试绑定一个随机的端口。若`address`未指定,操作系统会尝试在所有地址上监听。绑定完成时会触发一个`'listening'`事件,并会调用`callback`方法。

Expand Down
4 changes: 1 addition & 3 deletions dgram/socket_setbroadcast_flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ added: v0.6.9

* `flag` {Boolean}

Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
packets may be sent to a local interface's broadcast address.

设置或清除 `SO_BROADCAST` socket 选项。当设置为 `true`, UDP包可能会被发送到一个本地接口的广播地址
4 changes: 2 additions & 2 deletions dgram/socket_setmulticastloopback_flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ added: v0.3.8

* `flag` {Boolean}

Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
multicast packets will also be received on the local interface.
设置或清除 `IP_MULTICAST_LOOP` socket 选项。当设置为 `true`, 多播数据包也将在本地接口接收。


0 comments on commit b1b01bc

Please sign in to comment.