예제 #1
0
        public unsafe void BroadCastMsg(byte[] msg)
        {
            Console.WriteLine("Start broadcasting " + msg.Length + " bytes");

            PrepareBroadcastFrame(msg);

            numBroadcastBeginAcked = 0;
            numBroadcastEndAcked = 0;

            //Get the begin and end message
            BroadcastBeginPar beginPar = new BroadcastBeginPar();
            beginPar.frameNum = curBroadcastSeqNum;
            beginPar.lastPacketPayload = curFrameLastPktSize;
            beginPar.numPackets = curBroadcastFrame.Count;
            beginPar.packetPayload = payloadSizeUDP;

            BroadcastEndPar endPar = new BroadcastEndPar();
            endPar.frameNum = curBroadcastSeqNum;

            beginMsg = msgParser.getBroadcastBeginMsg(ref beginPar);
            endMsg = msgParser.getBroadcastEndMsg(ref endPar);

            //Send out the begin message
            foreach (POIUser u in POIGlobalVar.UserProfiles.Values)
            {
                u.BroadcastCtrlHandler.resetStateVariables();
                u.SendData(beginMsg, ConType.TCP_CONTROL);
            }

            myBroadcastState = BroadcastState.WaitForBeginAck;
        }
예제 #2
0
        public byte[] getBroadcastEndMsg(ref BroadcastEndPar par)
        {
            byte[] parBytes = new byte[POIMsgDefinition.POI_MAXPARAMETERSSIZE];

            int offset = 0;
            serializeInt32(parBytes, ref offset, par.frameNum);

            parBytes = parBytes.Take(offset).ToArray();
            return composePacket(POIMsgDefinition.POI_BROADCASTEND, parBytes);
        }