Server.listenLocal

bool listenLocal(uint port, soup.types.ServerListenOptions options)

Attempts to set up server to listen for connections on "localhost".

That is, 127.0.0.1 and/or ::1, depending on whether options includes [soup.types.ServerListenOptions.Ipv4Only], [soup.types.ServerListenOptions.Ipv6Only], or neither). If port is specified, server will listen on that port. If it is 0, server will find an unused port to listen on. (In that case, you can use [soup.server.Server.getUris] to find out what port it ended up choosing.

See [soup.server.Server.listen] for more details.

Parameters

portthe port to listen on, or 0
optionslistening options for this server

Returns

true on success, false if port could not be bound

or any other error occurred (in which case error will be set).

Throws

[ErrorWrap]