class Fleyhe::Network::Listener

Accept Bridges in the server, and configure it

Public Class Methods

new(port=3030,event=Event) click to toggle source
# File lib/Fleyhe.rb, line 18
def initialize port=3030,event=Event
    # Config the event
    @event = event
    @event.generateHash
    
    
    # Config the TCPServer
    @tcp = TCPServer.new port
    
    #Config the thread for working
    @thread = Thread.new {
        self.work
    }
end

Public Instance Methods

close() click to toggle source
# File lib/Fleyhe.rb, line 33
def close
    @thread.kill
    @tcp.close
end

Protected Instance Methods

work() click to toggle source
# File lib/Fleyhe.rb, line 39
def work
    loop {
        Bridge.new(@tcp.accept, @event)
        sleep 1
    }
end