'listening' 事件


一旦 dgram.Socket 可寻址并且可以接收数据,则会触发 'listening' 事件。 这会在 socket.bind() 中显式地发生,或者在第一次使用 socket.send() 发送数据时隐式地发生。 直到 dgram.Socket 正在监听,底层系统资源不存在,则调用 socket.address()socket.setTTL() 等将失败。

The 'listening' event is emitted once the dgram.Socket is addressable and can receive data. This happens either explicitly with socket.bind() or implicitly the first time data is sent using socket.send(). Until the dgram.Socket is listening, the underlying system resources do not exist and calls such as socket.address() and socket.setTTL() will fail.