ruby - Detecting eventmachine disconnections and testing for reconnect -
ruby - Detecting eventmachine disconnections and testing for reconnect -
i'm trying build scheme ontop of event machine observe when tcp connection has failed , test see if reconnect can fired. i've gone through of eventmachine code can't seem find there callback connection either timing out in action or in reconnection. though i've set times in code, there no callback on pending connect, , if seek re fire reconnect no feedback whether connection has succeeded or failed. i'm using connect telnet interface.
eventmachine.run c = eventmachine.connect "10.8.1.99",5000,connectinterface c.pending_connect_timeout = 10
end
any help appreciated.
eventmachine provide unbind method this:
module connectinterface def connection_completed puts "connected" end def unbind puts "disconnected" end end em::run em::connect("10.8.1.99", 5000, connectinterface) end
be aware unbind method called on disconnect whether triggered disconnect or not.
ruby sockets telnet eventmachine reconnect
Comments
Post a Comment