helloworld_nokeepalive/
helloworld-nokeepalive.rs1#[cfg(feature = "server")]
2fn main() {
3 use ehttpd::Server;
4 use ehttpd::http::Response;
5
6 let server = Server::with_request_response(2048, |_| {
8 let mut response = Response::new_200_ok();
9 response.set_body_data(b"Hello world\r\n");
10 response.set_connection_close();
11 response
12 });
13
14 let Err(e) = server.accept("[::]:9999");
16 panic!("Server failed: {e}");
17}
18
19#[cfg(not(feature = "server"))]
20fn main() {
21 panic!("The `server`-feature must be enabled for this example to run")
22}