public NetState(PacketRegistry packetRegistry) { Asserter.AssertIsNotNull(packetRegistry, "packetRegistry"); _packetRegistry = packetRegistry; _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _recvBuffer = new BufferPool("Receive Buffer", 16, 4096); _messagePump = new MessagePump(); _buffer = new ByteQueue(); }
public NetState(PacketRegistry packetRegistry) { Asserter.AssertIsNotNull(packetRegistry, "packetRegistry"); _packetRegistry = packetRegistry; _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _recvBuffer = new BufferPool("Receive Buffer", 16, 4096); _messagePump = new MessagePump(); _buffer = new ByteQueue(); }
public void Dispose() { if (_socket == null || _disposing) { return; } _disposing = true; try { _socket.Shutdown(SocketShutdown.Both); } catch (SocketException ex) { Tracer.Error(ex); } try { _socket.Close(); } catch (SocketException ex) { Tracer.Error(ex); } _socket = null; _buffer = null; }