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
已解决! 转到解答。
 Luis_Garabo
		
			Luis_Garabo
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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!
-----------------------------------------------------------------------------------------------------------------------
 Luis_Garabo
		
			Luis_Garabo
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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!
-----------------------------------------------------------------------------------------------------------------------
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
 Luis_Garabo
		
			Luis_Garabo
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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!
-----------------------------------------------------------------------------------------------------------------------
