How to stop RTCS DHCP server

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to stop RTCS DHCP server

跳至解决方案
1,285 次查看
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

标签 (1)
0 项奖励
回复
1 解答
1,103 次查看
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 项奖励
回复
3 回复数
1,103 次查看
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 项奖励
回复
1,103 次查看
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 项奖励
回复
1,104 次查看
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 项奖励
回复