private void InitUdp(int port = 8893) { try { SocketMessageMng socket = new SocketMessageMng(port); socket.UdpStartListen(); socket.SetTextEvent += Socket_SetTextEvent; } catch (Exception ex) { Console.WriteLine("Udp异常:{0}", ex.ToString()); } }
/// <summary> /// 实例化转化发消息 /// </summary> /// <param name="port"></param> public virtual void InitUdp(int port, string desc) { try { socket = new SocketMessageMng(port); socket.UdpStartListen(); socket.SetTextEvent += Socket_SetTextEvent; logger.Info("Udp初始化成功:{0}" + (string.IsNullOrEmpty(desc) ? string.Empty : "," + desc), port); } catch (Exception ex) { logger.Error("Udp异常:{0}", ex.ToString()); } }