Begin forwarded message:

> From: Robert Engels <reng...@ix.netcom.com>
> Date: August 26, 2019 at 7:38:20 PM CDT
> To: Tanner Ryan <he...@tannerryan.ca>
> Subject: Re: [go-nuts] Multiple interface addresses and UDPConn.WriteToUDP
> 
> If the network is set up properly the kernel should chose the correct network 
> interface based on the destination IP address. 
> 
> The only time this doesn’t apply is with multicast packets so as to not flood 
> the network. In this case you set the interface you want to send on. 
> 
>> On Aug 26, 2019, at 3:47 PM, 'Tanner Ryan' via golang-nuts 
>> <golang-nuts@googlegroups.com> wrote:
>> 
>> Hi,
>> 
>> I was hoping someone could help me with an issue. I have a simple UDP server 
>> that listens on a specific port, responding with a message back.
>> 
>> conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4(0, 0, 0, 0), 
>> Port: *port})
>> 
>> When reading messages, I use the source address for sending a response back.
>> 
>> n, sourceAddr, err := conn.ReadFromUDP(buff)
>> conn.WriteToUDP(reply, sourceAddr)
>> 
>> When my WAN interface has a single IPv4 address, the server can read and 
>> respond properly. When there's an additional IPv4 address on the WAN, 
>> requests to the second IP are successful received, but the response is not 
>> received by the original sender.
>> 
>> Is there another way to fix this other than explicitly calling ListenUDP on 
>> the two addresses?
>> 
>> 
>> Best,
>> Tanner
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/accf321d-75ad-4afb-9709-54ced8b37c5e%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9AE579B7-1F12-4856-901D-A43F808C1127%40ix.netcom.com.

Reply via email to