public Connection(IPEndPoint ipPort) { this.ipPort = ipPort; this.netHandler = new NetworkHandler(); this.frameDecoder = new LengthFieldBasedFrameDecoder(NHNet._MAX_COMPRESS_MESSAGE_SIZE, 2, 4, 0, 0); this.bufferMgr = new BufferMgr(); this.EventArgsMgr = new EventArgsMgr(this); this.evenCount = 0; hasInit = true; this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.NoDelay = true; this.status = NHNet.CON_CLOSED; }
public void ReInit() { try { socket.Close(); this.netHandler = new NetworkHandler(); this.frameDecoder = new LengthFieldBasedFrameDecoder(NHNet._MAX_COMPRESS_MESSAGE_SIZE, 2, 4, 0, 0); this.bufferMgr = new BufferMgr(); lock (eventLock) { this.EventArgsMgr = new EventArgsMgr(this); evenCount = 0; } this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.NoDelay = true; this.status = NHNet.CON_CLOSED; } catch (Exception ex) { LogU.Warn("reInitConection exception {0}", ex.ToString()); } }