Obsolete
/
ipcd
Archived
3
0
Fork 0

Websocketd: `-l host` parameter

master
Philippe PITTOLI 2019-11-04 09:15:42 +01:00
parent 115e6f5b0a
commit 1495728777
1 changed files with 6 additions and 1 deletions

View File

@ -37,9 +37,14 @@ class WrappedTCPFileDescriptor < TCPSocket
end end
service_name = "websocket" service_name = "websocket"
host = "0.0.0.0"
port_to_listen = 1234 port_to_listen = 1234
OptionParser.parse! do |parser| OptionParser.parse! do |parser|
parser.on "-l host", "--l host", "IP address to listen on." do |h|
host = h
end
parser.on "-p port", "--port port", "Port to listen on." do |port| parser.on "-p port", "--port port", "Port to listen on." do |port|
port_to_listen = port.to_u16 port_to_listen = port.to_u16
end end
@ -111,7 +116,7 @@ class InstanceStorage
end end
# by default, listen on any IP address # by default, listen on any IP address
server = TCPServer.new("0.0.0.0", port_to_listen) server = TCPServer.new(host, port_to_listen)
service = IPC::SwitchingService.new service_name service = IPC::SwitchingService.new service_name
service << server.fd service << server.fd
context = InstanceStorage.new service context = InstanceStorage.new service