'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.