Created
September 12, 2017 21:58
-
-
Save cgibsonmm/8385d41e8b5ceb0c8c868f39325c30ac to your computer and use it in GitHub Desktop.
Error while tying to run webrick, doesn't matter what port I specify I still get the same error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./myserver.rb | |
[2017-09-12 16:39:30] INFO WEBrick 1.3.1 | |
[2017-09-12 16:39:30] INFO ruby 2.0.0 (2015-12-16) [universal.x86_64-darwin16] | |
[2017-09-12 16:39:30] WARN TCPServer Error: Address already in use - bind(2) | |
[2017-09-12 16:39:30] INFO WEBrick::GenericServer#start: pid=30434 port=3321 | |
# on shutdown | |
^C[2017-09-12 16:40:38] INFO going to shutdown ... | |
[2017-09-12 16:40:38] INFO WEBrick::GenericServer#start done. | |
#any lsof | grep 3321 returns no results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'webrick' | |
server = WEBrick::GenericServer.new Port: 3321 | |
trap('INT') { server.shutdown } | |
server.start do |socket| | |
socket.puts Time.now | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Ruby code is verbatim what is in Beginning Ruby.