Package io.ktor.network.sockets

Types

ABoundSocket
Link copied to clipboard
common
interface ABoundSocket
Represents a bound socket
Acceptable
Link copied to clipboard
common
interface Acceptable<out S : ASocket> : ASocket
Represents a socket source, for example server socket
AConnectedSocket
Link copied to clipboard
common
interface AConnectedSocket : AWritable
Represent a connected socket
AReadable
Link copied to clipboard
common
interface AReadable
Represent a readable socket
ASocket
Link copied to clipboard
common
interface ASocket : Closeable, DisposableHandle
Base type for all async sockets
AWritable
Link copied to clipboard
common
interface AWritable
Represents a writable socket
BoundDatagramSocket
Link copied to clipboard
common
Represents a bound datagram socket
Configurable
Link copied to clipboard
common
interface Configurable<out T : Configurable<T, Options>, Options : SocketOptions>
Represent a configurable socket
ConnectedDatagramSocket
Link copied to clipboard
common
Represents a connected datagram socket.
Connection
Link copied to clipboard
common
class Connection(socket: Socket, input: ByteReadChannel, output: ByteWriteChannel)
Represents a connected socket with its input and output
Datagram
Link copied to clipboard
common
class Datagram(packet: ByteReadPacket, address: NetworkAddress)
UDP datagram with packet content targeted to address
DatagramReadChannel
Link copied to clipboard
common
interface DatagramReadChannel
A channel for receiving datagrams
DatagramReadWriteChannel
Link copied to clipboard
common
interface DatagramReadWriteChannel : DatagramReadChannel, DatagramWriteChannel
A channel for sending and receiving datagrams
DatagramWriteChannel
Link copied to clipboard
common
interface DatagramWriteChannel
A channel for sending datagrams
ReadWriteSocket
Link copied to clipboard
common
interface ReadWriteSocket : ASocket, AReadable, AWritable
Represents both readable and writable socket
ServerSocket
Link copied to clipboard
common
interface ServerSocket : ASocket, ABoundSocket, Acceptable<Socket>
Represents a server bound socket ready for accepting connections
Socket
Link copied to clipboard
common
interface Socket : ReadWriteSocket, ABoundSocket, AConnectedSocket
Represents a connected socket
SocketBuilder
Link copied to clipboard
common
class SocketBuilder : Configurable<SocketBuilder, SocketOptions>
Socket builder
SocketOptions
Link copied to clipboard
common
sealed class SocketOptions
Socket options builder
SocketTimeoutException
Link copied to clipboard
class SocketTimeoutException : IOException
typealias SocketTimeoutException = SocketTimeoutException
TcpSocketBuilder
Link copied to clipboard
common
class TcpSocketBuilder(selector: SelectorManager, options: SocketOptions) : Configurable<TcpSocketBuilder, SocketOptions>
TCP socket builder
TypeOfService
Link copied to clipboard
common
inline class TypeOfService(value: UByte)
An inline class to hold a IP ToS value
UDPSocketBuilder
Link copied to clipboard
common
UDP socket builder

Functions

aSocket
Link copied to clipboard
common
fun aSocket(selector: SelectorManager): SocketBuilder
Start building a socket
awaitClosed
Link copied to clipboard
common
suspend fun ASocket.awaitClosed()
Await until socket close
connect
Link copied to clipboard
suspend fun TcpSocketBuilder.connect(remoteAddress: SocketAddress, configure: SocketOptions.TCPClientSocketOptions.() -> Unit = {}): Socket
connection
Link copied to clipboard
common
fun Socket.connection(): Connection
Opens socket input and output channels and returns connection object
openReadChannel
Link copied to clipboard
common
fun AReadable.openReadChannel(): ByteReadChannel
Open a read channel, could be done only once
openWriteChannel
Link copied to clipboard
common
fun AWritable.openWriteChannel(autoFlush: Boolean = false): ByteWriteChannel
Open a write channel, could be opened only once
tcpNoDelay
Link copied to clipboard
common
fun <T : Configurable<T, *>> T.tcpNoDelay(): T
Set TCP_NODELAY socket option to disable the Nagle algorithm.

Properties

isClosed
Link copied to clipboard
common
val ASocket.isClosed: Boolean
Check if the socket is closed