123456789101112131415161718 |
- #!/usr/bin/ruby
- var inet = require('IO::Socket::INET');
- var sock = inet.new(
- LocalAddr => "127.0.0.1:8080",
- Listen => 1,
- Reuse => 1,
- );
- while (var client = sock.accept) {
- client.print ("HTTP/1.1 200 OK\r\n" +
- "Content-Type: text/html; charset=UTF-8\r\n\r\n" +
- "<html><head><title>Goodbye, world!</title></head>" +
- "<body>Goodbye, world!</body></html>\r\n");
- client.close;
- }
|