CoroutineSrtSocket

A coroutine-based SRT socket.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class IncomingSocket(val socket: CoroutineSrtSocket, val streamId: String)

Listening socket data class. Use to store the socket and the stream ID.

Properties

Link copied to clipboard

Gets the time when SRT socket was open to establish a connection.

Link copied to clipboard
open override val coroutineContext: CompletableJob
Link copied to clipboard

Flow of incoming sockets. It is a hook before returning from accept. Reject an incoming connection by throwing an exception. Only for server sockets.

Link copied to clipboard

Retrieves the remote InetAddress to which the socket is connected.

Link copied to clipboard

Tests if the SRT socket is bound.

Link copied to clipboard

Tests if the SRT socket is closed.

Link copied to clipboard

Tests if the SRT socket is connected.

Link copied to clipboard

Check if the SRT socket is a valid SRT socket.

Link copied to clipboard

Extracts the InetAddress to which the socket was bound.

Link copied to clipboard

Extracts the port to which the socket was bound.

Link copied to clipboard

Retrieves the remote InetSocketAddress to which the SRT socket is connected.

Link copied to clipboard
val port: Int

Retrieves the port to which the SRT socket is connected.

Link copied to clipboard

Sets/gets the value of the SockOpt.RCVBUF option for this SRT socket.

Link copied to clipboard

Set/get detailed reason for a failed connection attempt.

Link copied to clipboard

Tests if SockOpt.REUSEADDR is enabled.

Link copied to clipboard

Sets/gets the value of the SockOpt.SNDBUF option for this SRT socket.

Link copied to clipboard
val socketContext: CompletableJob
Link copied to clipboard

Extracts the InetSocketAddress to which the socket was bound.

Link copied to clipboard

Gets the current status of the socket.

Link copied to clipboard

Returns setting for SockOpt.LINGER.

Functions

Link copied to clipboard

Accepts a pending connection.

Link copied to clipboard
fun available(): Int

Get the size of the available data in the receive buffer.

Link copied to clipboard
suspend fun bind(address: InetSocketAddress)

Binds the socket to a local address.

Link copied to clipboard
suspend fun CoroutineSrtSocket.bind(srtUrl: SrtUrl)
suspend fun CoroutineSrtSocket.bind(url: String)
suspend fun CoroutineSrtSocket.bind(address: InetAddress, port: Int)
suspend fun CoroutineSrtSocket.bind(address: String, port: Int)

Binds the socket to a local address.

Link copied to clipboard
fun bistats(clear: Boolean, instantaneous: Boolean): Stats

Reports the current statistics.

Link copied to clipboard
fun bstats(clear: Boolean): Stats

Reports the current statistics.

Link copied to clipboard
fun close()

Closes the socket or group and frees all used resources.

Link copied to clipboard
suspend fun connect(address: InetSocketAddress)

Connects a socket to a specified address and port.

Link copied to clipboard
suspend fun CoroutineSrtSocket.connect(srtUrl: SrtUrl)

Connects a socket to an URL.

suspend fun CoroutineSrtSocket.connect(address: InetAddress, port: Int)
suspend fun CoroutineSrtSocket.connect(address: String, port: Int)

Connects a socket to a specified address and port.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun getSockFlag(opt: SockOpt): Any

Gets the value of the given socket option.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun listen(backlog: Int)

Sets up the listening state on a socket.

Link copied to clipboard
suspend fun recv(size: Int): ByteArray
suspend fun recv(size: Int, msgCtrl: MsgCtrl): ByteArray
suspend fun recv(buffer: ByteArray, offset: Int = 0, byteCount: Int = buffer.size): Int
suspend fun recv(buffer: ByteArray, offset: Int = 0, byteCount: Int = buffer.size, msgCtrl: MsgCtrl): Int

Received a message from a remote device

Link copied to clipboard
suspend fun recvFile(path: String, offset: Long = 0, size: Long, block: Int = 364000): Long

Receives a file. File will be located at path.

Link copied to clipboard
suspend fun CoroutineSrtSocket.recvFile(file: File, offset: Long = 0, size: Long, block: Int = 7280000): Long

Receives a file. File is create in file.

Link copied to clipboard
suspend fun rendezVous(localAddress: InetSocketAddress, remoteAddress: InetSocketAddress)

Performs a rendezvous connection.

Link copied to clipboard
suspend fun CoroutineSrtSocket.rendezVous(srtUrl: SrtUrl)
suspend fun CoroutineSrtSocket.rendezVous(localAddress: InetAddress, remoteAddress: InetAddress, port: Int)
suspend fun CoroutineSrtSocket.rendezVous(localAddress: String, remoteAddress: String, port: Int)

Performs a rendezvous connection.

Link copied to clipboard
suspend fun send(msg: ByteBuffer): Int
suspend fun send(msg: ByteBuffer, msgCtrl: MsgCtrl): Int
suspend fun send(msg: ByteArray, offset: Int = 0, size: Int = msg.size): Int
suspend fun send(msg: ByteArray, offset: Int, size: Int, msgCtrl: MsgCtrl): Int

Sends a message to a remote party.

Link copied to clipboard
suspend fun CoroutineSrtSocket.send(msg: String): Int

Sends a message to a remote party.

Link copied to clipboard
suspend fun sendFile(path: String, offset: Long = 0, size: Long, block: Int = 364000): Long

Sends a specified file.

Link copied to clipboard
suspend fun CoroutineSrtSocket.sendFile(file: File, offset: Long = 0, size: Long = file.length(), block: Int = 364000): Long

Sends a specified file.

Link copied to clipboard
open override fun setSockFlag(opt: SockOpt, value: Any)

Sets the value of the given socket option.