I am looking to develop an application in Kotlin that uses sockets,
Unfortunately kotlinx sockets is broken and does not get as far as the connect with the current co-routines.
Does anyone know a way around the problem with kotlinx.sockets, or can suggest an alternate approach to implementing socket comms? It seems the problem with kotlinx sockets was noted two months ago so there may be no quick fix.
kotlinx.sockets
is an incubating work in progress. It is not released yet, though we do plan to integrate it into kotlinx.coroutines
when it is ready.
Meanwhile, you can take a look at kotlinx-coroutines-nio
module of kotlinx.coroutines
that provides a minimal set of coroutine-friendly extension methods on NIO async sockets that can let you get started using sockets with coroutines. It has a sample echo server written with coroutines that you can check out here:
https://github.com/Kotlin/kotlinx.coroutines/blob/master/integration/kotlinx-coroutines-nio/src/test/kotlin/examples/echo-example.kt
1 Like
Did kotlinx.sockets end up getting merged into coroutines? There doesn’t seem to be much activity on the kotlinx.sockets github lately but I don’t see it mention of it in coroutines either.
Are there any news regarding this?