Exemplo n.º 1
0
    public void UpdateMessagePump()
    {
        if (!isStarted)
        {
            return;
        }

        int recHostId;    // Is this from Web? Or standalone
        int connectionId; // Which user is sending me this?
        int channelId;    // Which lane is he sending that message from

        byte[] recBuffer = new byte[BYTE_SIZE];
        int    dataSize;

        NetworkEventType type = NetworkTransport.Receive(out recHostId, out connectionId, out channelId, recBuffer, BYTE_SIZE, out dataSize, out error);

        switch (type)
        {
        case NetworkEventType.DataEvent:
            OnData(connectionId, channelId, recHostId, NetMessageSerializer.Deserialize(recBuffer));
            break;

        case NetworkEventType.Nothing:
            break;

        default:
            Debug.Log("Received Event of Type: " + type);
            break;
        }
    }