= create_server_socket
loop_and_listen_for_client_requests(socket)
end def loop_and_listen_for_client_requests(server)
loop do
client_socket, client_addrinfo = server.accept request = client_socket.recv(1056)
response = run_application_code client_socket.print response client_socket.close
end
end def run_application_code
status, headers, body = app.call({})
server_response = "HTTP/1.1 #{status}\r\n" +
"#{headers}" +
"\r\n" +
"#{body}"
end
Using the Rack interface!