1

I have multiple clients connecting on UDP. Their addresses are stored for future communications. If one dies and message is sent to it then recvfrom(2) gives me econnreset. Is there a way to know which peer died at this point?

the scenario looks like this

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
redka
  • 309
  • 1
  • 11

0 Answers0