How to shutdown a socket


#1

I’ve been working on a simple example with a Julia server and a C client communicating over a UNIX domain socket. If I call shutdown(my_socket, SHUT_RDWR) from the C client, then calling isopen(my_socket) in Julia returns false, as expected. But if I do try to have the Julia server shutdown the socket by calling close(my_socket), the C client’s pending recv call doesn’t return with an error, it just continues to block.

Does close(my_socket) not shutdown the socket in a way the client can see? Is there an equivalent to C’s shutdown in Julia?

Thank you for the help!


#2

I had an error in my Julia server - it was blocking trying to read more bytes than the client had sent. So it was never even closing the socket. With that fixed, my C client’s extra recv call does receive 0 bytes, as expected.