I am writing code that will communicate to a network via UDP. From the udp
documentation, all I have to do is specify a destination address and port and I can start sending/receiving data.
I have two separate Ethernet ports (and potentially a USB-to-RJ45 adapter) that I want to be able to communicate on. The documentation doesn't specify if there's a way to select what NIC card my data should be output on; is it possible to specify? My users will likely be connected to the Internet with their main Ethernet port, then using my code to do communication with the second port (or USB-to-RJ45). (These are two separate networks.)
I think the interesting question here is, why you would ever want to choose which NIC to communicate through?
Unless I'm missing the point, your application should only specify which server (ip and port) to connect to, and the TCP/IP routing scheme of the OS should choose the proper NIC to use based on the target network.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With