Have to work with Buffers for sending some stuff o...
# squarelibraries
c
Have to work with Buffers for sending some stuff over a tcp socket. Lower level stuff than what I'm used to in android app land, but I'm doing it in a multiplatform fashion. I have it working with java, but now want it to support kmp. Seems like I can either go for okio or https://github.com/Kotlin/kotlinx-io. Does anyone here have any strong reasons to go for one or the other?
According to kotlin conf keynote... seems like jesses been helping a bunch on kotlinx.io? https://www.youtube.com/live/Ar73Axsz2YA?si=4P36VRqXpeax8MDZ&t=2552 so maybe okio is already planned to be succeeded by kotlinx.io?
j
If it's a library use Okio
❤️ 1
If it's your own code where you can tolerate an unstable API, use kotlinx.io
❤️ 1
c
just watched

https://www.youtube.com/watch?v=Du7YXPAV1M8

and omg. where has this been all my life. ive gone through java101 classes always bewildered by the io fundamentals. what a great whirlwind tour!
🙌 1
💯 1
m
I’d go with Okio. Kotlinx-io may be the future but at the moment it has a lot of missing features and strange behaviour which are really a paint when you realize them late in your development. I recently stumbled over this, for example. https://github.com/Kotlin/kotlinx-io/issues/223
j
But they're not using files
c
Thanks for the experience Michael! And yeah, my usecase is insanely specific right now. Just sending some bytes over a raw tcp socket (working on a thing that interacts with a smart home device)
t
Ktor supports TCP sockets
c
yep. im using ktor. but im currently using java.nio.buffer to send things over ktor. but trying to make that kmp compatible
t
Ktor 3.x uses kotlinx-io now so unless you want to convert between the two I think kotlinx-io would be more easier
c
interesting. i am using ktor 3.x at the moment. But the way that Buffers work there are not like java.nio. Maybe I should revisit it again