'message' 事件


当套接字上有新的数据报可用时,则会触发 'message' 事件。 事件句柄传入了两个参数:msgrinfo

如果传入数据包的源地址是 IPv6 链路本地地址,则将接口名称添加到 address。 例如,在 en0 接口上接收的数据包可能将地址字段设置为 'fe80::2618:1234:ab11:3b9c%en0',其中 '%en0' 是作为区域 ID 后缀的接口名称。

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.

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.