Exemplo n.º 1
0
        void OnEnable()
        {
            var udpClients = UDPBoxFactory.GeterateUdpClientsArray(1235, 1236);

            mUDPBoxConnect = new UDPBox(udpClients, UDPBoxUtility.DefaultHead);
            mUDPBoxConnect.Start();
            mUDPBoxBroadcast = new UDPBoxBroadcast(udpClients[0], 1234);
        }
Exemplo n.º 2
0
        void OnEnable()
        {
            var udpClients1 = UDPBoxFactory.GeterateUdpClientsArray(1234, 1235);

            mUDPBox1 = new UDPBox(udpClients1, UDPBoxUtility.DefaultHead);
            var udpClients2 = UDPBoxFactory.GeterateUdpClientsArray(1235, 1236);

            mUDPBox2 = new UDPBox(udpClients2, UDPBoxUtility.DefaultHead);
        }
Exemplo n.º 3
0
        public void Start(bool isMaster)
        {
            IsMaster = isMaster;

            if (mUseInternalBroadcastLogic)
            {
                mBroadcastUdpClient = UDPBoxFactory.GeterateUdpClient(BroadcastListenPort);
                mUDPBoxBroadcast    = UDPBoxFactory.GenerateStandardUDPBoxBroadcastAndSetup(mBroadcastUdpClient, BroadcastSendPort, BroadcastNetPrefixIP, this);
            }

            UDPBox.RegistMessageIntercept(InterceptAndUpdateConnectState);
            UDPBox.RegistWorkThreadOperate(RefreshConnectStateInWorkThread);
            UDPBox.Start();
        }
Exemplo n.º 4
0
        public void Initialization(string packageHead, bool useInternalBroadcastLogic)
        {
            mUseInternalBroadcastLogic = useInternalBroadcastLogic;

            var udpClientArray = new UDPBox_UDPClient[UdpBoxEndPort - UdpBoxBeginPort];

            for (int i = 0, port = UdpBoxBeginPort; port < UdpBoxEndPort; i++, port++)
            {
                udpClientArray[i] = UDPBoxFactory.GeterateUdpClient(port);
            }
            UDPBox.Initialization(udpClientArray, packageHead);

            mEstablishConnectPackage = new EstablishConnectPackage(PackageHeadBytes);
            mPingPongPackageTemplate = new PingPongPackage(PackageHeadBytes);
            SelfIPAddress            = SelfIPAddress ?? UDPBoxUtility.GetSelfIP(BroadcastNetPrefixIP);
        }