MgetTypeOfService
Bun

method

net.Socket.getTypeOfService

getTypeOfService(): number;

Returns the current Type of Service (TOS) field for IPv4 packets or Traffic Class for IPv6 packets for this socket.

setTypeOfService() may be called before the socket is connected; the value will be cached and applied when the socket establishes a connection. getTypeOfService() will return the currently set value even before connection.

On some platforms (e.g., Linux), certain TOS/ECN bits may be masked or ignored, and behavior can differ between IPv4 and IPv6 or dual-stack sockets. Callers should verify platform-specific semantics.

@returns

The current TOS value.