- Index
- »
- inet
- »
- SocketConfig
type
SocketConfig
src
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
acceptTimeout |
Controls how long a |
---|---|
broadcast |
|
connectTimeout |
Controls the default timeout used by |
inBufferSize |
The size in bytes for the sys::InStream buffer. |
keepAlive |
|
keystore |
The |
linger |
|
noDelay |
|
outBufferSize |
The size in bytes for the sys::OutStream buffer. |
receiveBufferSize |
|
receiveTimeout |
|
reuseAddr |
|
sendBufferSize |
|
trafficClass |
The type-of-class byte in the IP packet header. |
truststore |
The |
methods
copy |
Create a copy of this configuration and then apply any overrides from the it-block. |
---|---|
cur |
Get the current, default socket configuration |
setCur |
Set a new default socket configuration. |
setTimeouts |
Convenience to create a copy of this socket configuration and set the connect and receive timeouts to the given duration. |
Slot Details
acceptTimeout
src
const Duration? acceptTimeout := null
Controls how long a TcpListener.accept
will block before throwing an IOErr timeout exception. null
is used to indicate infinite timeout.
broadcast
connectTimeout
src
const Duration? connectTimeout := 1min
Controls the default timeout used by TcpSocket.connect
. A null value indicates a system default timeout (usually wait forever).
copy
cur
src
static SocketConfig cur()
Get the current, default socket configuration
inBufferSize
keepAlive
keystore
linger
make
noDelay
outBufferSize
receiveBufferSize
receiveTimeout
reuseAddr
sendBufferSize
setCur
src
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
trafficClass
src
const Int trafficClass := 0
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.