helloworld_nokeepalive/
helloworld-nokeepalive.rs1#[cfg(feature = "server")]
2fn main() {
3 use ehttpd::Server;
4 use ehttpd::http::{Response, ResponseExt};
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 server.accept("[::]:9999").expect("server failed");
16}
17
18#[cfg(not(feature = "server"))]
19fn main() {
20 panic!("The `server`-feature must be enabled for this example to run")
21}