Socket

interface Socket : ReadWriteSocket, ABoundSocket, AConnectedSocket

Represents a connected socket

Functions

Link copied to clipboard
abstract fun attachForReading(channel: <ERROR CLASS>): <ERROR CLASS>

Attach channel for reading so incoming bytes appears in the attached channel. Only one channel could be attached

Link copied to clipboard
abstract fun attachForWriting(channel: <ERROR CLASS>): <ERROR CLASS>

Attach channel for writing so bytes written to the attached channel will be transmitted Only one channel could be attached

Link copied to clipboard
open override fun dispose()

Properties

Link copied to clipboard
abstract val localAddress: SocketAddress

Local socket address. Could throw an exception if no address bound yet.

Link copied to clipboard
abstract val remoteAddress: SocketAddress

Remote socket address. Could throw an exception if the peer is not yet connected or already disconnected.

Link copied to clipboard
abstract val socketContext: Job

Represents a socket lifetime, completes at socket closure

Extensions

Link copied to clipboard
fun Socket.connection(): Connection

Opens socket input and output channels and returns connection object