This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can bind() 2 or more IP Address to respectively different socket by using NDK?

Other Parts Discussed in Thread: OMAP-L138

We want to bind() 2 or more IP Address to respectively different socket by using NDK.

We created 2 sockets by using socket() in our application and bind() IP Address to sockets.

socket 1 : 192.168.0.100

socket 2 : 192.168.0.200

 

We tried to run our application on a board (Processor:OMAP-L138) and ping to 192.168.0.100 or 192.168.0.200 from PC.

But, we could get echo reply only from 192.168.0.100, there were no echo reply from 192.168.0.200.

Please tell me how to bind() 2 or more IP Address to respectively different socket.

 

  • Hi NAO EMOTO,

    Which version of the NDK are you using? BIOS version?

    Which hardware platform?

    There have been customers who have successfully done this, however it seems there is a limitation with binding multiple IP addresses in the NDK - the addresses must be on different sub nets.

    Please refer to this forum for some more details.

    Steve

  • Hi Steven,

    Thank you for your response, and I'm sorry for the delayed response of me.

     

    Steven Connell said:

    Which version of the NDK are you using? BIOS version?

    Which hardware platform?

    NDK version : 2.22.03.20

    BIOS version : 6.35.04.50

    Hardware Platform : TMDXLCDK138

     

    Steven Connell said:

    There have been customers who have successfully done this, however it seems there is a limitation with binding multiple IP addresses in the NDK - the addresses must be on different sub nets.

    We want to bind() multiple IP address in same subnet to different sockets,
    please tell me how to do this.

  • Well, as I mentioned previously it seems that there is a limitation with binding multiple IP addresses to the same interface unless they are on different sub nets.

    However, you can try with code similar to this (pseudo) code:

        CI_IPNET NA;

        HANDLE      hCfgIpAddr;

        /* Setup manual IP address */
        bzero(&NA, sizeof(NA));
        NA.IPAddr  = inet_addr("146.252.161.45");
        NA.IPMask  = inet_addr("255.255.255.0");
        strcpy(NA.Domain, "demo.net");
        NA.NetType = 0;

          /* add a new static IP entry */
        CfgAddEntry(0, CFGTAG_IPNET, 1, CFG_ADDMODE_DUPLICATE ,
                sizeof(CI_IPNET), (UINT8 *)&NA, 0);

        NA.IPAddr  = inet_addr("146.252.161.50");

        /* add a new static IP entry */
        CfgAddEntry(0, CFGTAG_IPNET, 1, CFG_ADDMODE_DUPLICATE ,
                sizeof(CI_IPNET), (UINT8 *)&NA, 0);
    }

    Steve

  • Steven,

    Thank you for your advice.

    We tried with your code.

     

    As a result,

    it is successful to ping to IP Address added by the first CfgAddEntry().

    But, second CfgAddEntry() return the following Error code:

     

    CfgAddEntry Error Code:-101

    CFG_GET_SERVICE_ERROR(-101) Error Code:-1

     

    Could you give me any advice?

  • Hi Nao Emoto,

    Unfortunately it simply isn't supported at this time.  The following enhancement request has been filed to track this:

    SDOCM00101855 Add IP aliasing support to NDK

    The best I can offer you at this time is the work around mentioned previously, with the limitation of the IP addresses being on different subnets.

    Steve

  • Steven,

     

    I could understand "multiple IP Address(in same subnet) on NDK" is not supported now.

    Thank you for your kind help.

     

    Nao Emoto