public ClientConnection(Socket sock) : base(sock) { if (SlotId == 0) SlotId = -1; var remoteEndPoint = (IPEndPoint)sock.RemoteEndPoint; _remoteAddress = new TcpAddress(remoteEndPoint.Address, remoteEndPoint.Port); sock.LingerState = new LingerOption(true, 10); sock.NoDelay = true; var ctx = new HookContext { Connection = this }; var args = new HookArgs.NewConnection(); HookPoints.NewConnection.Invoke(ref ctx, ref args); if (ctx.CheckForKick()) return; _isReceiving = true; //The connection was established, so we can begin reading }
public ClientConnection(Socket socket, int slot) : base(socket) { //var buf = NewNetMessage.buffer[id]; //socket.SendBufferSize = 128000; connectedAt = time.Elapsed; if (slot >= 0) AssignSlot(slot); socket.LingerState = new LingerOption(true, 10); var ctx = new HookContext { Connection = this }; var args = new HookArgs.NewConnection(); HookPoints.NewConnection.Invoke(ref ctx, ref args); if (ctx.CheckForKick()) return; lock (All) { indexInAll = All.Count; All.Add(this); } StartReceiving(new byte[4192]); }
public ClientConnection(Socket sock) : base(sock) { if (SlotId == 0) { SlotId = -1; } var remoteEndPoint = (IPEndPoint)sock.RemoteEndPoint; _remoteAddress = new TcpAddress(remoteEndPoint.Address, remoteEndPoint.Port); sock.LingerState = new LingerOption(true, 10); var ctx = new HookContext { Connection = this }; var args = new HookArgs.NewConnection(); HookPoints.NewConnection.Invoke(ref ctx, ref args); if (ctx.CheckForKick()) { return; } _isReceiving = true; //The connection was established, so we can begin reading }
public ClientConnection(Socket socket, int slot) : base(socket) { //var buf = NewNetMessage.buffer[id]; //socket.SendBufferSize = 128000; connectedAt = time.Elapsed; if (slot >= 0) { AssignSlot(slot); } socket.LingerState = new LingerOption(true, 10); var ctx = new HookContext { Connection = this }; var args = new HookArgs.NewConnection(); HookPoints.NewConnection.Invoke(ref ctx, ref args); if (ctx.CheckForKick()) { return; } lock (All) { indexInAll = All.Count; All.Add(this); } StartReceiving(new byte[4192]); }