For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
option
Provides the traits that describe socket options, and the options that more than one kind of socket accepts.
Each protocol's option module, such as std.net.tcp.option, re-exports the
shared options that its sockets accept.
comptime values
ReuseAddress
comptime ReuseAddress = FlagOption["ReuseAddress", constant[StringSpan("SOL_SOCKET"), linux=Int32(1), macos=Int32(65535)](), constant[StringSpan("SO_REUSEADDR"), linux=Int32(2), macos=Int32(4)]()]
Represents SO_REUSEADDR: whether the socket can bind a local address that connections from an earlier socket still hold.
A server that restarts needs it to bind its port again while connections from its last run are still closing.
ReusePort
comptime ReusePort = FlagOption["ReusePort", constant[StringSpan("SOL_SOCKET"), linux=Int32(1), macos=Int32(65535)](), constant[StringSpan("SO_REUSEPORT"), linux=Int32(15), macos=Int32(512)]()]
Represents SO_REUSEPORT: whether other sockets can bind the same address and port.
Structs
-
FlagOption: Represents a socket option that is either on or off.
Traits
-
GettableSocketOption: Describes a socket option that can be read from a socket. -
SettableSocketOption: Describes a socket option that can be set on a socket. -
SocketOption: Describes a socket option by the type of its value.