Beispiel #1
0
        protected override void update()
        {
            byte[] readBytes = new byte[readBufferSize];
            while (true)
            {
                if (!active)
                {
                    return;
                }
                int bytesToRead = readSocketData(readBytes);
                if (bytesToRead <= 0)
                {
                    return;
                }
                byte[] binary = EzyBytes.copyBytes(readBytes, bytesToRead);
                decoder.decode(binary, decodeBytesCallback);

                networkStatistics.getSocketStats().getNetworkStats().addReadBytes(binary.Length);
                networkStatistics.getSocketStats().getNetworkStats().addReadPackets(1);
            }
        }
Beispiel #2
0
 private void onMesssageReceived(EzyMessage message)
 {
     try
     {
         Object data = decoder.decode(message);
         dataQueue.add((EzyArray)data);
         Console.WriteLine("udp received: " + data);
     }
     catch (Exception e)
     {
         logger.warn("decode error at socket-reader", e);
     }
 }