/// <summary>初始化</summary> /// <param name="config"></param> /// <returns></returns> public bool Init(string config) { Local = new NetUri(config); #if DEBUG //LogSend = true; //LogReceive = true; #endif // 新生命标准网络封包协议 SessionPacket = new DefaultPacketFactory(); return(true); }
/// <summary>初始化</summary> /// <param name="config"></param> /// <returns></returns> public virtual Boolean Init(String config) { Local = new NetUri(config); // 如果主机为空,监听所有端口 if (Local.Host.IsNullOrEmpty() || Local.Host == "*") { AddressFamily = System.Net.Sockets.AddressFamily.Unspecified; } #if DEBUG //LogSend = true; //LogReceive = true; #endif // 新生命标准网络封包协议 SessionPacket = new DefaultPacketFactory(); return(true); }
public void RegisterPacketType <TPacket>(ControlPacketType packetType) where TPacket : MQTTPacket, new() { _packetFactories[(int)packetType] = new DefaultPacketFactory <TPacket>(); }