class

SocketConfig

const class SocketConfig : Obj

Configuration options for TCP and UDP sockets. All socket types accept a socket configuration which will be used to configure the socket when it is created.

A system-wide default socket configuration can be obtained with SocketConfig.cur. You can change the system default by using SocketConfig.setCur.

See TcpSocket.make, TcpListener.make, UdpSocket.make, MulticastSocket.make

constructors make

Create and configure the socket options

fields broadcast

SO_BROADCAST socket option

keepAlive

SO_KEEPALIVE option

linger

SO_LINGER controls the linger time or set to null to disable linger

noDelay

TCP_NODELAY socket option specifies that send not be delayed to merge packets (Nagle's algorthm)

sendBufferSize

SO_SNDBUF option for the size in bytes of the IP stack buffers

reuseAddr

SO_REUSEADDR is used to control the time wait state of a closed socket

receiveBufferSize

SO_RCVBUF option for the size in bytes of the IP stack buffers

inBufferSize

The size in bytes for the sys::InStream buffer

receiveTimeout

SO_TIMEOUT controls the amount of time a socket will block on a read call before throwing an IOErr timeout exception

connectTimeout

Controls the default timeout used by TcpSocket.connect

acceptTimeout

Controls how long a TcpListener.accept will block before throwing an IOErr timeout exception

keystore

The KeyStore to use when creating secure sockets

truststore

The KeyStore to use for obtaining trusted certificates when creating secure sockets

trafficClass

The type-of-class byte in the IP packet header

outBufferSize

The size in bytes for the sys::OutStream buffer

methods cur

Get the current, default socket configuration

setTimeouts

Convenience to create a copy of this socket configuration and set the connect and receive timeouts to the given duration

copy

Create a copy of this configuration and then apply any overrides from the it-block

setCur

Set a new default socket configuration

acceptTimeout const Duration? : acceptTimeout

Controls how long a TcpListener.accept will block before throwing an IOErr timeout exception. null is used to indicate infinite timeout.

broadcast const Bool : broadcast

SO_BROADCAST socket option

connectTimeout const Duration? : connectTimeout

Controls the default timeout used by TcpSocket.connect. A null value indicates a system default timeout (usually wait forever).

copy virtual This copy(|This| f)

Create a copy of this configuration and then apply any overrides from the it-block.

cur static SocketConfig cur()

Get the current, default socket configuration

inBufferSize const Int? : inBufferSize

The size in bytes for the sys::InStream buffer. A value of 0 or null disables input stream buffing.

keepAlive const Bool : keepAlive

SO_KEEPALIVE option

keystore const KeyStore? : keystore

The KeyStore to use when creating secure sockets. If null, the runtime default will be used.

linger const Duration? : linger

SO_LINGER controls the linger time or set to null to disable linger.

make new make(|This|? f)

Create and configure the socket options.

noDelay const Bool : noDelay

TCP_NODELAY socket option specifies that send not be delayed to merge packets (Nagle's algorthm).

outBufferSize const Int? : outBufferSize

The size in bytes for the sys::OutStream buffer. A value of 0 or null disables output stream buffing.

receiveBufferSize const Int : receiveBufferSize

SO_RCVBUF option for the size in bytes of the IP stack buffers.

receiveTimeout const Duration? : receiveTimeout

SO_TIMEOUT controls the amount of time a socket will block on a read call before throwing an IOErr timeout exception. null is used to indicate an infinite timeout.

reuseAddr const Bool : reuseAddr

SO_REUSEADDR is used to control the time wait state of a closed socket.

sendBufferSize const Int : sendBufferSize

SO_SNDBUF option for the size in bytes of the IP stack buffers.

setCur static Void setCur(SocketConfig cfg)

Set a new default socket configuration. This configuration will only apply to new sockets created after this is called. This method may only be called once to change the default socket configuration.

setTimeouts This setTimeouts(Duration? connectTimeout, Duration? receiveTimeout)

Convenience to create a copy of this socket configuration and set the connect and receive timeouts to the given duration. Setting to null indicates infinite timeouts.

trafficClass const Int : trafficClass

The type-of-class byte in the IP packet header.

For IPv4 this value is detailed in RFC 1349 as the following bitset:

  • IPTOS_LOWCOST (0x02)
  • IPTOS_RELIABILITY (0x04)
  • IPTOS_THROUGHPUT (0x08)
  • IPTOS_LOWDELAY (0x10)

For IPv6 this is the value placed into the sin6_flowinfo header field.

truststore const KeyStore? : truststore

The KeyStore to use for obtaining trusted certificates when creating secure sockets. If null, the runtime default will be used.

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST