Hands-On-Network-Programming-with-C
                                
                                 Hands-On-Network-Programming-with-C copied to clipboard
                                
                                    Hands-On-Network-Programming-with-C copied to clipboard
                            
                            
                            
                        chapter 4: getaddrinfo() and destination IP of packet
Hi Lewis,
Have you ever done this with a UDP package?
https://stackoverflow.com/questions/5281409/get-destination-address-of-a-received-udp-packet
Looks like you can't use recvfrom and have to switch to recvmsg to use IP_PKTINFO
I'll dig into the book again.
Thanks for reading.
Gavin.
Hi Gavin,
No, I haven't done it like that using only one socket before. What I have done, is opened a separate socket on each interface, and then the receiving address is determined by which socket it comes in on. Using multiple sockets will probably be more portable, but otherwise, the Stack Overflow solution might be simpler and I suspect would perform slightly better (no socket multiplexing).
Thanks Lewis :-)