I have a UDP server listening for connections. When receiving a message from the handle_info, ie:
def handle_info({:udp, socket, ip, in_port, packet}, state) do
the ip and in_port are the IP and port of the server that the socket is listening on (192.168.1.1). I expected it to be the IP and port of the peer sending messages.
Ah, too bad. I have an old udp server and I was able to use the ip and port from the handle_info to reply to the client, but that was on a much older version of erlang and elixir, not sure if something changed, or it was the way my network interface was configured.
To be sure, your server and client are on different physical machines, correct?
Strange, the documentation says that the IP and port are the ones of the sender of the packet:
IP and InPortNo define the address from which Packet comes. Packet is a list of bytes if option list is specified. Packet is a binary if option binary is specified.