CAsyncSocket Bind() fails when multiple IP addresses are configured in a PC out of network

240 Views Asked by At

I have a PC which has multiple IP addresses configured and which is out of network.

I am trying to run a server software which is developed on VC++ using CAsyncSocket on this PC. But the Bind() function in this software always fails with an error WSAEADDRNOTAVAIL 10049.

But what I found is that the binding works fine in the following cases:

  • When the PC is connected to network
  • When a single IP address is configured in the PC

I fail to understand the dependency of socket binding with network connection and multiple IP configuration. Is this an issue with CAsyncSocket or is there a way to handle sockets in such situation?

EDIT:

Here is the code I use for socket creation (explicit binding) which is fairly straight forward:

ret = m_pAMC1_MAIN_VMS_A_SenderSocket->Create(m_amc1_main_vms_a_port_local, \
                        SOCK_DGRAM, FD_WRITE, (LPCTSTR) "193.0.161.111");

Note that the same code executes successful in the above listed cases.

0

There are 0 best solutions below