socket / UDP programming problem
Posted on 2006-05-26
I am programming a SNMP client that uses UDP protocol to communicate with SNMP agent (server). I need to use broadcast because the client does not know where the agent is.
If the client runs on a PC with single network adapter, it works well. But if there are two adapters on the PC and each of them have different network domain, e.g. 192.168.1.2 and 10.6.111.2, the client can not find the agent because it sends the packet via a wrong adapter.
My program looks like following scenario:
socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
Any comments are welcome.