UDP で接続している複数のクライアントがあります。それらのアドレスは、将来の通信のために保存されます。1 つが死んでメッセージが送信された場合、recvfrom(2) は econnreset を返します。この時点でどのピアが死亡したかを知る方法はありますか?
シナリオはこんな感じ
def broadcast message
# one of the clients is dead
clients.each { |x| @socket.send message, 0, x.ip, x.port }
end
def fill_inbox
@inbox << @socket.recvfrom(1000) while IO.select([@socket],nil,nil,0)
rescue Errno::ECONNRESET => e
# who died?
end