Skip to content

camdenorrb/Netlius

Repository files navigation

Netlius

License: MIT Build Status

A networking library for Kotlin

Dependency

Add Netlius as a dependency (version auto-updated by release-please):

implementation("dev.twelveoclock:netlius:1.6.4") // x-release-please-version

"Hello world" Server + Client example

fun main() {

    val server = Netlius.server("127.0.0.1", 12345)

    server.onConnect { client ->
        while (client.channel.isOpen) {
            println(client.suspendReadString())
        }
    }

    val client = Netlius.client("127.0.0.1", 12345)
    val packet = Packet().string("Hello World")

    runBlocking {
        client.queueAndFlush(packet)
        delay(10000)
    }

    server.stop()
}

About

A networking library for Kotlin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages