OxL Reference

method Server.port

The port the server listens on (useful with port: 0).

Example:

oxl✓ checked in CI
use std.http { Server, ServerConfig }

fn main() io, net {
  match Server.bind(ServerConfig{ port: 0 }) {
    Server s => {
      print("{s.port() > 0}")
      s.close()
    }
    NetError _ => print("cannot bind")
  }
}
Output
true
pub(api) fn port() -> u16

Since. 1.0.0-beta

Returns

u16

Effects

none declared (pure unless the body says otherwise)

Defined in: std/http/http.oxl:4353

See also