Class: ProconBypassMan::ProconDisplay::Server
- Inherits:
-
Object
- Object
- ProconBypassMan::ProconDisplay::Server
- Defined in:
- lib/procon_bypass_man/procon_display/server.rb
Constant Summary collapse
- PORT =
9900
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
A new instance of Server.
- #start_with_foreground ⇒ Object
Constructor Details
Class Method Details
.start! ⇒ Object
7 8 9 10 11 |
# File 'lib/procon_bypass_man/procon_display/server.rb', line 7 def self.start! Thread.new do new.start_with_foreground end end |
Instance Method Details
#start_with_foreground ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/procon_bypass_man/procon_display/server.rb', line 17 def start_with_foreground loop do conn = @server.accept response = ServerApp.new( HttpRequest.parse(conn).to_hash ).call conn.write(response) conn.close end rescue Errno::EADDRINUSE => e ProconBypassMan::SendErrorCommand.execute(error: e) rescue => e ProconBypassMan::SendErrorCommand.execute(error: e) retry end |