TcpSocketBuilder

class TcpSocketBuilder : 
    Configurable<TcpSocketBuilder, SocketOptions>

TCP socket builder

Constructors

<init>

TcpSocketBuilder(
    selector: SelectorManager,
    options: SocketOptions)

TCP socket builder

Properties

options

var options: SocketOptions

Current socket options

Functions

bind

fun bind(
    hostname: String = "0.0.0.0",
    port: Int = 0,
    configure: AcceptorOptions.() -> Unit = {}
): ServerSocket

Bind server socket at port to listen to hostname.

fun bind(
    localAddress: NetworkAddress? = null,
    configure: AcceptorOptions.() -> Unit = {}
): ServerSocket

Bind server socket to listen to localAddress.

connect

suspend fun connect(
    hostname: String,
    port: Int,
    configure: TCPClientSocketOptions.() -> Unit = {}
): Socket

Connect to hostname and port.

suspend fun connect(
    remoteAddress: NetworkAddress,
    configure: TCPClientSocketOptions.() -> Unit = {}
): Socket

Connect to remoteAddress.

Inherited Functions

configure

open fun configure(block: Options.() -> Unit): T

Configure socket options in block function

Extension Functions

connect

suspend fun TcpSocketBuilder.connect(
    remoteAddress: SocketAddress,
    configure: TCPClientSocketOptions.() -> Unit = {}
): Socket