0
我在事件機器中有一個連接對象的句柄:http://eventmachine.rubyforge.org/EventMachine/Connection.html如何檢查EventMachine :: Connection是否打開?
如何在任何時間點檢查連接是打開還是關閉? 我沒有看到API中指定的任何方法。
我在事件機器中有一個連接對象的句柄:http://eventmachine.rubyforge.org/EventMachine/Connection.html如何檢查EventMachine :: Connection是否打開?
如何在任何時間點檢查連接是打開還是關閉? 我沒有看到API中指定的任何方法。
你必須自己實現它,這很容易。
class SampleConnection < EM::Connection
attr_accessor :connected
def connection_completed
connected = true
end
def connected?
!!connected
end
def unbind
connected = false
end
end
是的,它很容易實現它自己。我想仔細檢查課堂中是否已有任何解決方案。 – Kowshik