public IHttpActionResult UDPSendMsg(string strIP, int nPort, string strMsg) { try { SocketMessageMng sm = new SocketMessageMng(); sm.UdpSendMsg(strIP, nPort, strMsg); sm.Dis(); return(Ok(new { status = 1, data = true })); } catch (Exception ex) { return(Ok(new { status = 1, data = false })); } }
/// <summary> /// 释放资源 /// </summary> public void Dis() { socket?.Dis(); }
/// <summary> /// 停止服务 /// </summary> public void Stop() { socket.Dis(); }