How to stop RTCS DHCP server

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to stop RTCS DHCP server

Jump to solution
1,286 Views
JasonPeng
Contributor I

Hi All,

I am using RTCS DHCP server on the MQX 4.02. DHCP server is working on our product.

As our product requirement, I need to stop the RTCS DHCP server. In the MQX_RTCS_User_Guide.pdf, I can't find the stop DHCP server API.

Can anyone give me some insight how to stop RTCS DHCP server?

Thanks in advance,

Jason

Labels (1)
0 Kudos
Reply
1 Solution
1,104 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Jason,

The error makes sense. This is a brutal stop for the DHCP. This means that there is not a clean up of the sockets used by the task. You will need to create a function that kills the DHCP task and clean up all the resources associated to it.


Have a great day,
Garabo

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
1,104 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Jason,

Just as you pointed, there is not a function to stop the DHCP server. What you can do is to kill the task. Take this code as an example:

/* Start DHCP Server: */

error = DHCPSRV_init(“DHCP server”, 7, 2000);

/* Kill DHCP server */

task_id = _task_get_id_from_name(“DHCP server”);

_task_abort(task_id);

I hope this helps.

Have a great day,
Garabo

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,104 Views
JasonPeng
Contributor I

Hi Garabo,

Thank you for your reply.

The DHCP server task can be killed after running your code.

However I got the error when I restart DHCP server.

  // Start DHCP Server

    error = DHCPSRV_init("DHCP server", 7, 2000);

    if (error != RTCS_OK) {  <== error is 0x1663 (RTCSERR_UDP_PORT_OPEN)

      return error;

    }

   

Any idea?

Thanks a lot!

Jason

0 Kudos
Reply
1,105 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Jason,

The error makes sense. This is a brutal stop for the DHCP. This means that there is not a clean up of the sockets used by the task. You will need to create a function that kills the DHCP task and clean up all the resources associated to it.


Have a great day,
Garabo

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply