// Update is called once per frame
    void Update()
    {
        if (IsConnected() == true)
        {
            byte[] packet = new byte[m_packetSize];

            // 도달 보증 패킷을 수신합니다.
            while (m_tcp != null && m_tcp.Receive(ref packet, packet.Length) > 0)
            {
                // 수신 패킷을 분배합니다.
                ReceivePacket(packet);
            }

            // 비도달 보증 패킷을 수신합니다.
            while (m_udp != null && m_udp.Receive(ref packet, packet.Length) > 0)
            {
                // 수신 패킷을 분배합니다.
                ReceivePacket(packet);
            }
        }

        if (m_tcp != null)
        {
            // TCP의 송수신 처리.
            m_tcp.Dispatch();
        }

        if (m_udp != null)
        {
            // UDP의 송수신 처리.
            m_udp.Dispatch();
        }
    }
Exemple #2
0
    //
    void Dispatch()
    {
        while (m_isStarted == true)
        {
            // 클라이언트와의 수신을 처리합니다.
            if (m_tcp != null)
            {
                // TCP의 송수신 처리.
                m_tcp.Dispatch();
            }

            if (m_udp != null)
            {
                // UDP의 송수신 처리.
                m_udp.Dispatch();
            }

            Thread.Sleep(5);
        }
    }