TcpSocketBuilder

TCP socket builder

Constructors

Link copied to clipboard
constructor(selector: SelectorManager, options: SocketOptions)

Properties

Link copied to clipboard
open override var options: SocketOptions

Current socket options

Functions

Link copied to clipboard
fun bind(localAddress: SocketAddress? = null, configure: SocketOptions.AcceptorOptions.() -> Unit = {}): ServerSocket

Bind server socket to listen to localAddress.

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

Bind server socket at port to listen to hostname.

Link copied to clipboard

Configure socket options in block function

Link copied to clipboard
suspend fun connect(remoteAddress: SocketAddress, configure: SocketOptions.TCPClientSocketOptions.() -> Unit = {}): Socket

Connect to remoteAddress.

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

Connect to hostname and port.