Class: NetworkFacade::Unix::Server

Inherits:
Base::Server show all
Defined in:
lib/network-facade/unix.rb

Instance Method Summary collapse

Methods inherited from Base::Server

#add, #client_id, #read, #start, #write

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



15
16
17
18
19
20
21
# File 'lib/network-facade/unix.rb', line 15

def initialize(options = {})
	options[:path] ||= PATH
	options[:close_exec] ||= true
	File.unlink(PATH)
	options[:server] ||= UNIXServer.open(options[:path])
	super(options)
end

Instance Method Details

#acceptObject



23
24
25
26
27
# File 'lib/network-facade/unix.rb', line 23

def accept
	client = @options[:server].accept
	client.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if @options[:close_exec]
	@fd << client
end