public UdpPacketWriter(UdpRemoteClient client)
     : base(client)
 {
     UdpRemote = client;
 }
        void Callback(IAsyncResult result)
        {
            if (String.IsNullOrWhiteSpace(Thread.CurrentThread.Name))
                Thread.CurrentThread.Name = "ReadCallbackThread";
            UdpRemoteClient client = null;
            try
            {
                IPEndPoint point = ServerEndPoint;
                byte[] data = mListener.EndReceive(result, ref point);

                if (data.Length == 1025)
                {

                    // PacketInit packetID //
                    if (data[0] == 0x00)
                    {
                        client = new UdpRemoteClient(point);
                        Clients.Add(point.ToString(), client);
                        client.StartClient();
                    }
                    else
                    {
                        var stringy = point.ToString();
                        if (!String.IsNullOrWhiteSpace(stringy))
                        {
                            readQueue.Enqueue(new QueueBlob(point.ToString(), data));
                        }
                    }
                }
            }
            catch (Exception)
            {
                if (client != null)
                {
                    client.Disconnect();
                }
            }

            if (_shuttingDown) return;

            // Size of our PacketInit packet //
            mListener.BeginReceive(Callback, null);
        }
 public UdpPacketReader(UdpRemoteClient client)
     : base(client)
 {
     UdpClient = client;
 }