AnsweredAssumed Answered

ipcfg_bind_staticip() block

Question asked by Emanuele Trapani on Dec 16, 2015
Latest reply on Jan 5, 2016 by soledad

hi, i'm working on mqx 4.2, cw 10.6 and frmk64f.

I have a LAN with multiple device. every device start with a bootloader that have a static ip fixed with ipcfg_bind_staticip() function and this ip is the same for every one. sometimes happens that 2 or more devices start at the same time. my code for bind is:

 

   while(1) {
    err=ipcfg_bind_staticip(BSP_DEFAULT_ENET_DEVICE,&my_ip_data);
    
    if(err==IPCFG_OK){
         break;
    }
    _time_delay(2000);
  }

my test is: i keep a device in the bootloader, bound with this static ip in the LAN. when i start the second device, always in the LAN, it do not go over this while cycle. at this point i release the first device from the bootloader leaving this ip free.

the documentation explain that:

"This function tries to bind device to network using given IPv4 address information. If the

address is already used, an error is returned. This is blocking function, i.e., doesn't return

until the process is finished or error occurs."

So i expected that the ipcfg_bind_staticip() return that the address is already in use until, finally, it succeed to bound this ip to the device.

why it not happens?  the device remain indefinitely in this while cycle.

Outcomes