Example #1
0
        public override ushort Send(NativeList <ushort> playerIdList, DataStreamWriter data, QosType qos, bool noChunk = false)
        {
            if (state == State.Offline)
            {
                Debug.LogError("Send Failed : State.Offline");
                return(0);
            }
            ushort seqNum = 0;

            using (var writer = CreateSendPacket(data, qos, playerIdList, playerId)) {
                if (networkLinkerHandle.IsCreated)
                {
                    NetworkLinker linker = NetworkLinkerPool.GetLinker(networkLinkerHandle);
                    if (linker != null)
                    {
                        seqNum = linker.Send(writer, qos, noChunk);
                    }
                }
                else
                {
                    Debug.LogError("Send Failed : is not create networkLinker");
                }
            }
            return(seqNum);
        }
Example #2
0
        public static NetworkLinkerHandle CreateLinkerHandle(UdpCNetworkDriver driver, NetworkConnection connection)
        {
            NetworkLinkerHandle handle;

            for (int i = 0; i < networkLinkers.Count; i++)
            {
                if (networkLinkers[i] == null)
                {
                    handle            = new NetworkLinkerHandle(i + 1);
                    networkLinkers[i] = new NetworkLinker(handle, driver, connection, MTU);
                    return(handle);
                }
            }

            handle = new NetworkLinkerHandle(networkLinkers.Count + 1);
            networkLinkers.Add(new NetworkLinker(handle, driver, connection, MTU));
            return(handle);
        }