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();
        }
Example #2
0
 private void PassData(NetworkReader from, NetworkWriter to)
 {
     Packet packet;
     {
         for (; ; )
         {
             packet = Packet.Get(from);
             packet.Write(to);
         }
     }
 }
Example #3
0
 public abstract void Read(NetworkReader reader);
Example #4
0
 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;
 }