事件:'message'
\Event: 'message'
版本历史
| 版本 | 变更 |
|---|---|
| v18.4.0 | 属性 |
| v18.0.0 | 属性 |
| v0.1.99 | 新增于: v0.1.99 |
当套接字上有新的数据报可用时,则会触发 'message' 事件。事件处理函数传递了两个参数:msg 和 rinfo。
\The 'message' event is emitted when a new datagram is available on a socket.
The event handler function is passed two arguments: msg and rinfo.
-
msg<Buffer> 消息。\
msg<Buffer> The message. -
rinfo<Object> 远程地址信息。\
rinfo<Object> Remote address information.
如果传入数据包的源地址是 IPv6 链路本地地址,则将接口名称添加到 address。例如,在 en0 接口上接收的数据包可能将地址字段设置为 'fe80::2618:1234:ab11:3b9c%en0',其中 '%en0' 是作为区域 ID 后缀的接口名称。
\If the source address of the incoming packet is an IPv6 link-local
address, the interface name is added to the address. For
example, a packet received on the en0 interface might have the
address field set to 'fe80::2618:1234:ab11:3b9c%en0', where '%en0'
is the interface name as a zone ID suffix.