Restarting Netx

SSP 1.1.3

Let's say I wish to restart NetX stuff because an error has occurred, like the cable got unplugged.   What is the proper procedure?

Here's what I've tried.  When an error is detected, sit in a loop trying to init everything.  If anything fails, stop and delete everything that was started, and try again.  So basically, 

Stop HttpServer, Stop DHCP, delete DNS, Delete DHCP, Delete HTTP, delete IP instance, delete Packet Pool in that order.  Then, recreate everything just like before.

When I do this with the cable unplugged, the first time through the loop it works fine i.e. detects no IP returned from DHCP and it unwinds itself.  The second time,  when it gets around to the DHCP server, it goes away and never comes back on the ip_status_check:

status = nx_dhcp_create(&dhcp_0, &ip_0, "SynergyBaseDHCP");
status = nx_dhcp_start(&dhcp_0);

status = nx_ip_status_check(&ip_0, NX_IP_ADDRESS_RESOLVED, &dhcp_status, 500);

All the Stops and deletes return status 0.  All subsequent creates and starts return 0. 


  • Hi Bill,

    just a hint from another "user":
    in the NetX user docu there is another way described on how to check the status of an ethernet link. Independent from the curiosity of your problem you could use this approach as a kind of workaround.

    /* Make a direct call to the application-specific network driver for the previously created IP instance.
    For this example, the network driver is interrogated for the link status. */
    status = nx_ip_driver_direct_command(&ip_0, NX_LINK_GET_STATUS, &link_status);
    /* If status is NX_SUCCESS, the link_status variable contains a
    NX_TRUE or NX_FALSE value representing the status of the physical link. */

    Good luck and have fun :-)
  • In reply to @remo:


    Any response to this? What is the proper way to restart networking?
  • In reply to wflynn:

    Hi Bill,

    Did you memset the packet pool, nx_ip and other data structures to 0 before restarting. the stack?
    Please try that and see if it makes a difference.

  • In reply to garyj:


    Also, are you calling the nx_system_initialize() to do a clean start of NetX ?

  • In reply to garyj:

    No I didn't. I will try that. What other data structures specifically? For packet pool I deleted and recreated, same with nx_ip. I would have thought that would initialize them properly, especially since I did an nx_system_initialize.
  • In reply to garyj:

    Did that. I would think that would take care of setting everything up so no need to memset. If I need to memset to restart, don't I need to do it to start initially?
  • In reply to wflynn:

    The c-runtime initialization zeroes uninitialized memory so the first time you run bring up the network, all of the structures are initialized to 0.