Example #1
0
 public void ReceivePacket(NetcodePacket packet)
 {
     // push packet onto the queue
     lock (packetQueue)
     {
         packetQueue.Enqueue(packet);
     }
 }
Example #2
0
        protected static void handleClientMessage(int clientHandle, int clientID, IntPtr packetBufferPtr, int packetBufferLength)
        {
#if USE_WEBGL_PLUGIN
            unsafe
            {
                byte *byteBufferPtr = (byte *)packetBufferPtr.ToPointer();

                // grab a byte list off of the pool and copy the bytes over
                ByteBuffer byteArray = BufferPool.GetBuffer(packetBufferLength);
                byteArray.MemoryCopy(byteBufferPtr, 0, packetBufferLength);

                // create packet struct
                NetcodePacket packet = new NetcodePacket();
                packet.ClientID     = clientID;
                packet.PacketBuffer = byteArray;

                // route packet to client by client handle
                var client = clients[clientHandle];
                client.ReceivePacket(packet);
            }
#endif
        }