1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414#
15- # ************************************************************** #
15+ # ********************************************************************************************************************** #
1616# WHEN WHO WHAT, WHERE, WHY
17- # ---------- ----------- -------------------------- #
17+ # ********************************************************************************************************************** #
1818# 23/01/2024 Francis Add timeout handling
19- # ************************************************************** #
19+ # ---------- ----------- ---------------------------------------------------------------------------------- #
20+ # 06/08/2025 Sirius Fix port occupation issue by adding socket release in stop function, retaining del
21+ # ********************************************************************************************************************* #
2022
2123import usocket
2224import log
@@ -206,6 +208,7 @@ def set_default_NIC(self, ip_str):
206208 def stop (self ):
207209 _thread .stop_thread (self .__threadid )
208210 slip .destroy ()
211+ self .__sock .close ()#释放socket
209212 return RET_CODE .RET_SUCCESS_CODE
210213
211214 # 封装tlv数据包
@@ -229,6 +232,7 @@ def __unpack_tlv_format(self, msg):
229232 return RET_CODE .RET_RESPONSE_ERROR_CODE
230233 unpack = (tag ,length ,value )
231234 return unpack
235+
232236
233237 # socket通信(UDP)模块
234238 def __Socket_UDP (self , head , content ):
@@ -248,7 +252,8 @@ def __Socket_UDP(self, head, content):
248252 data = self .__queue .get ()
249253 self .__wait_resp = 0
250254 return data
251-
255+ def __def__ (self ):
256+ self .stop ()
252257 # socket通信(UDP)模块
253258 def __Socket_Thread (self ):
254259 while True :
0 commit comments