class Loguse::Shell
Attributes
host[RW]
port[RW]
s[RW]
Public Class Methods
new(host, port)
click to toggle source
# File lib/loguse/shell.rb, line 12 def initialize(host, port) @host = host @port = port @s = nil self.async.run end
Public Instance Methods
close()
click to toggle source
# File lib/loguse/shell.rb, line 43 def close @s.close end
open?()
click to toggle source
# File lib/loguse/shell.rb, line 47 def open? @s && !@s.closed? end
run()
click to toggle source
# File lib/loguse/shell.rb, line 20 def run t = Thread.new { begin @s = TCPSocket.open @host, @port @s.print "$~" while line = s.gets begin @s.puts `#{line.chomp}` @s.print "$~" rescue @s.print "Invalid Command..." end end close rescue end } t.join end