public BidirectionalStream(NetworkReader from, NetworkWriter to, PacketHandler packetHandler) { reader = from; writer = to; handler = packetHandler; var rStart = new ThreadStart(Run); readerThread = new Thread(rStart); readerThread.Start(); }
private void PassData(NetworkReader from, NetworkWriter to) { Packet packet; { for (; ; ) { packet = Packet.Get(from); packet.Write(to); } } }
public abstract void Read(NetworkReader reader);
public static Packet Get(NetworkReader reader, bool log = false) { PacketType packetId = reader.ReadPacketHeader(); var packet = Get(packetId, log); if (packet == null) return null; packet.Read(reader); if (packetCheck[packet.Type] == false) { Uberminer.Log("{0} read size: {1}", packet.Type, packet.NumBytesRead); } return packet; }