I'm during interop with a C library that allows passing a file descriptor for a socket, and I want to create the socket in Julia and pass it to the library without having to bind to a port and accept a connection. Am I correct in thinking that the easiest way to do that would be to ccall socketpair()? In this case all the communication will be internal to the process so I don't want to listen on a port. I'm thinking that I'll pass one file descriptor to the C library and wrap the other in an IOStream to read/write to it.
Hmm, on second thoughts it's probably more portable to create a temporary TCPServer
and create a connection from there. But then I need to get the file descriptor from the TCPSocket
.
Last updated: Nov 22 2024 at 04:41 UTC