public PacketCommunicator(PacketConnectionBase connection, Stream stream, PacketRegistry registry) { Registry = registry; Connection = connection; Packets = new BlockingCollection <Packet>(); Reader = new BinaryReader(stream, Encoding.UTF8, true); Writer = new BinaryWriter(stream, Encoding.UTF8, true); NotifiedTypes = new HashSet <Type>(); thread(ReadLoop); thread(SendLoop); void thread(Action act) => new Thread(new ThreadStart(act)) { IsBackground = true }.Start(); }
public PacketClient(string ip, int port) { Ip = ip; Port = port; Registry = new PacketRegistry(); }
public PacketServer(int port) { Registry = new PacketRegistry(); ConnectionsList = new List <PacketServerConnection>(); Listener = new TcpListener(IPAddress.Any, port); }