TcpSocketBuilder

class TcpSocketBuilder : 
    Configurable<TcpSocketBuilder, 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: SocketAddress? = 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: SocketAddress,
    configure: TCPClientSocketOptions.() -> Unit = {}
): Socket

Connect to remoteAddress

Inherited Functions

configure

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

Configure socket options in block function