<div dir="ltr">I'm getting an {error, badarg} result from file:sendfile/2 when the socket argument was originally accepted from a unix domain socket.<br>The elixir script below demonstrates the problem:<br><br>require Logger<br><br>File.rm("local.sock")<br>File.write!("tmp.txt", "Hello World\n")<div><br>{:ok, socket} = :gen_tcp.listen(0, [:binary, packet: :line, active: false, ip: {:local, "local.sock"}])<br>#  {:ok, socket} = :gen_tcp.listen(4000, [:binary, packet: :line, active: false])<br><br></div><div>{:ok, client} = :gen_tcp.accept(socket)<br>case :file.sendfile("tmp.txt", client) do<br>    {:ok, sent} -><br>        Logger.info("sent #{sent} bytes")<br>    error -><br>        Logger.error(inspect(error))<br>end</div><div><br></div><div>Swapping the call to gen_tcp:listen with the version using tcp port 4000 works successfully.  </div><div>Should file:sendfile/2 work with unix domain sockets?</div><div><br></div><div>Thanks</div></div>