TcpSocketBuilder

class TcpSocketBuilder(selector: SelectorManager, options: SocketOptions) : Configurable<TcpSocketBuilder, SocketOptions>

TCP socket builder

Constructors

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

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
open fun configure(block: SocketOptions.() -> Unit): TcpSocketBuilder

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.

Properties

Link copied to clipboard
open override var options: SocketOptions

Current socket options

Extensions

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