LanSession

class LanSession(context: Context)

One peer-to-peer connection over the local network. The host opens a TCP server socket and advertises it with NSD (mDNS); the joiner discovers it (or types the IP) and connects. No data leaves the LAN and there is no server.

Constructors

Link copied to clipboard
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val hosts: StateFlow<List<LanHost>>
Link copied to clipboard
val messages: SharedFlow<LanMessage>
Link copied to clipboard
val status: StateFlow<LanStatus>

Functions

Link copied to clipboard
fun close(sendBye: Boolean = true)
Link copied to clipboard
fun host(alias: String, myName: String, myColor: Long, boardSize: Int)

Hosts under this device's persistent alias, so opponents keep a history with it.

Link copied to clipboard
fun join(address: String, port: Int, alias: String, myAlias: String, myName: String, myColor: Long)
Link copied to clipboard
fun send(message: LanMessage)
Link copied to clipboard
Link copied to clipboard