I've run into a snag with some TCP Listeners that I have deployed under a "real world" testing basis. I have a server that listens for incoming data over a TCP connection across multiple ports using threading. This has been working great for the past 4-5 weeks except now its coming time to add the second portion of this project which is connecting more remote machines that reside on another network.
My server has dual NIC cards, and the master (eth0) is currently being used by the remote machines that are working properly. I made the poor assumption that when I specified:
server_address.sin_addr.s_addr = INADDR_ANY
that it would accept connections regardless on which NIC they were received as the OS would handle it. The more I thought about it the more I realized that was probably not the case, and now I know I'm correct in that it is an error. (<---- is that an oxymoron?)
Has anyone done a TCP Listener with multiple NICs? How do I specify the different NIC's IP Addresses as the ones I want to listen to? I realize that I will need 2 TCP Listeners, one for each NIC, just not sure how to set that up.