SrtSocket

This class represents a SRT socket. To avoid creating an unresponsive UI, don't perform SRT network operations on the main thread. Once it has been called, you must release Srt context with Srt.cleanUp when application leaves.

Constructors

Link copied to clipboard
constructor(af: StandardProtocolFamily)

Deprecated version of SrtSocket constructor. Argument is ignored. Also, it crashes on old Android version (where StandardProtocolFamily does not exist).

constructor()

Creates an SRT socket.

Types

Link copied to clipboard
interface ClientListener

This interface is used by a client SrtSocket to notify SRT socket events.

Link copied to clipboard
object Companion
Link copied to clipboard
interface ServerListener

This interface is used by a server SrtSocket to notify SRT socket events.

Properties

Link copied to clipboard
Link copied to clipboard

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

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
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
fun bind(address: InetSocketAddress)
fun bind(address: InetAddress, port: Int)
fun bind(address: String, port: Int)

Binds the socket to a local address.

Link copied to clipboard
fun SrtSocket.bind(srtUrl: SrtUrl)

Binds the socket to a local address.

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

Reports the current statistics.

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

Reports the current statistics.

Link copied to clipboard
open override fun close()

Closes the socket or group and frees all used resources.

Link copied to clipboard
fun connect(address: InetAddress, port: Int)
fun connect(address: String, port: Int)

Connects a socket to a specified address and port.

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

Connects a socket to an URL.

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

Return true if internal SRT socket are equals

Link copied to clipboard
fun getInputStream(msgCtrl: MsgCtrl? = null): InputStream

Returns an input stream for this socket.

Link copied to clipboard
fun getOutputStream(msgCtrl: MsgCtrl? = null): OutputStream

Returns an output stream for this socket.

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
fun recv(size: Int): ByteArray
fun recv(size: Int, msgCtrl: MsgCtrl): ByteArray
fun recv(buffer: ByteArray, offset: Int = 0, byteCount: Int = buffer.size): Int
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
fun recvFile(file: File, offset: Long = 0, size: Long, block: Int = 7280000): Long

Receives a file. File will be located at path.

fun recvFile(path: String, offset: Long = 0, size: Long, block: Int = 7280000): Long

Receives a file. File will be located at path.

Link copied to clipboard
fun rendezVous(localAddress: InetSocketAddress, remoteAddress: InetSocketAddress)
fun rendezVous(localAddress: InetAddress, remoteAddress: InetAddress, port: Int)
fun rendezVous(localAddress: String, remoteAddress: String, port: Int)

Performs a rendezvous connection.

Link copied to clipboard

Performs a rendezvous connection.

Link copied to clipboard
fun send(msg: ByteBuffer): Int
fun send(msg: ByteArray): Int
fun send(msg: String): Int
fun send(msg: ByteBuffer, msgCtrl: MsgCtrl): Int
fun send(msg: ByteArray, msgCtrl: MsgCtrl): Int
fun send(msg: String, msgCtrl: MsgCtrl): Int
fun send(msg: ByteBuffer, ttl: Int = -1, inOrder: Boolean = false): Int
fun send(msg: ByteArray, ttl: Int = -1, inOrder: Boolean = false): Int
fun send(msg: ByteArray, offset: Int, size: Int): Int
fun send(msg: String, ttl: Int = -1, inOrder: Boolean = false): Int
fun send(msg: ByteArray, offset: Int, size: Int, msgCtrl: MsgCtrl): Int
fun send(msg: ByteArray, offset: Int, size: Int, ttl: Int = -1, inOrder: Boolean = false): Int

Sends a message to a remote party.

Link copied to clipboard
fun sendFile(file: File, block: Int = 364000): Long
fun sendFile(file: File, offset: Long = 0, size: Long = file.length(), block: Int = 364000): Long
fun sendFile(path: String, offset: Long = 0, size: Long, 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.