https://kotlinlang.org logo
#ktor
Title
# ktor
o

Oleg Yukhnevich

09/25/2020, 9:27 AM
@e5l Just for curiosity, how stable now TCP Native? Im trying to run tests, which create client and server and communicate. And sometimes it work, and then just stopped sending or receiving data. Or I can't close it, it just block on calling
Socket.close
. BTW, what is the best way to close client and server TCP? (seems like order of calling close matters some how)
e

e5l

09/25/2020, 9:32 AM
Hey @Oleg Yukhnevich, tcp native API is stable. If you have any problems please file an issue. We will investigate and fix the problem
o

Oleg Yukhnevich

09/25/2020, 9:34 AM
TBH, it very hard to create some minimal reproducible snippets that will always fail... But I will try to create
After some investigation it happens when switching workers/dispatchers on K/N. writing / reading in the same dispatcher, where channel(read/write) opened - works well
👍 1
Hey, Im here once more time May be you can point some restrictions for usage of TCP client/server on K/N Here are some of my questions: 1. how to properly close
Socket
and
ServerSocket
- I can do close. or cancel it's context, does it matter? Do I need to close/cancel accepted
Socket
from
ServerSocket
when I don't use it? 2. Can I share
SelectorManager
between different client/server sockets running concurrently? 3. Can I reuse
SelectorManager
after closing of
ServerSocket
, because seems, If I create one server socket using selector, accept socket, then close server socket, then I create new server socket, and it doesn't accept new sockets... (Im recreating tcp builder, calling
aSocket(selector)
on same selector, doesn't closing selector, because sometimes, closing selector is just block forever) 4. What about threads (workers), can I create/accept socket on one thread, and then open channels to read on another? 5. Some other restrictions, that can cause socket to not close, or to freeze some how?
Hey, @e5l can you help me here? I really want rsocket-kotlin to support native server, but for now, I can't, as it's works really differently from JVM. Any suggestions? Or I will need to wait until ktor will support k/n cio server, and then will go through code :)?
5 Views