NetCoreServer
NetCoreServer copied to clipboard
Pass Socket to new instance of program
I'm trying to do a hot swap with NetCoreServer (Tcp classes). The idea is, new server program is compiled, it's loaded and the Sockets are handed off to a new instance of the server (with new code running) without ever having lost connection.
I can PInvoke to libc
and use execl
to start a new version of the program (with updated code) under the same pid that should have access to those sockets. I haven't been able to read those socket/file descriptors back into a Socket
though (I tried to create a SafeSocketHandle
to create the new Socket
which I would then register in the TcpServer
. I was able to get it to at least tell me that the socket was in use on the var socket = new Socket(safeHandle)
. I did successfully use those calls in C to test the theory. I've read in a few dotnet runtime issue threads that it should be possible to use a socket from a file descriptor in this way but I haven't seen any examples of it in the wild.
Curious if anyone has tried something like this with NetCoreServer or has any experience creating a socket from an existing Linux file descriptor?