Sha256: eadaa6f8b3de852e9cdb9b8ad4bb53a847efb597db4385e782d61c233e2b1fd8
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
require "fileutils" module Invoker module CommandListener class Server SOCKET_PATH = "/tmp/invoker" def initialize @open_clients = [] clean_old_socket() UNIXServer.open(SOCKET_PATH) do |client| loop do client_socket = client.accept process_client(client_socket) end end end def clean_old_socket if File.exists?(SOCKET_PATH) FileUtils.rm(SOCKET_PATH, :force => true) end end def process_client(client_socket) client = Invoker::CommandListener::Client.new(client_socket) client.read_and_execute end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
invoker-0.0.3 | lib/invoker/command_listener/server.rb |
invoker-0.0.2 | lib/invoker/command_listener/server.rb |