Stream: helpdesk (published)

Topic: Creating sockets for C


view this post on Zulip James Wrigley (Mar 13 2024 at 09:33):

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.

view this post on Zulip James Wrigley (Mar 13 2024 at 09:47):

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: Dec 28 2024 at 04:38 UTC