Help SOCKET dual card C language programming problems

Basic situation: UDP communication, dual card, a card inside, configuration IP:192.168.103.110, gateway: 192.168.103.1, the RTP transmission will join the multicast group, a network of foreign configuration IP:172.16.0.100, gateway 172.16.0.1, foreign is just transceiver SIP protocol packet, port 5060
As previously configured with only a card, so to see socket just bind INADDR_ANY,

Question 1: the need to build two SOCKET? The Socket1 binding IP1 and port 5060, socket2 bound IP2 and port 5060, Socket1 network (network 1) to send and receive UDP packets, socket2 on the outer (NIC 2) to send and receive UDP packets, this will have a problem?

Question 2: if bind or INADDR_ANY, can receive all packets, but to send, I hope to send to the 192.168.103.1 network by network 1, the other received address for IP1 (192.168.103.110), sent to the 172.16.0.1 network by network 2, on receipt of address for IP2 (172.16.0.100), how to achieve this effect, need to do?

The problem of 3: 2 through the configuration of the routing tables to achieve it?


Everybody do me a favor, thank you!!

Started by Cleveland at November 16, 2016 - 4:29 PM

I tried on the windows, looks like two cards can not bind the same port number…

Posted by Keith at November 22, 2016 - 5:17 PM

Now begin to learn things, the socket function can have more than one client

Posted by Kerry at December 04, 2016 - 6:16 PM