Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 728 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 728 Bytes

Netlius

License: MIT Build Status

A networking library for Kotlin


"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()
}