public TcpStreamListener(ulong bufferSize = 1024, InitializeSocketMethod clientMethod = null, InitializeImmutablePacketMethod packetMethod = null) { BufferSize = bufferSize; if (clientMethod == null) CreateClientMethod = CreateStandardSocket; if (packetMethod == null) CreatePacketMethod = CreateStandardPacket; Clients = new List<ISocket>(); Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); }
public TcpStreamListener(ushort port, ulong bufferSize = 1024, InitializeSocketMethod clientMethod = null, InitializeImmutablePacketMethod packetMethod = null) : this(bufferSize, clientMethod, packetMethod) { Socket.Bind(new IPEndPoint(IPAddress.Any, port)); }