public void Start(AppParams appParams_in)
        {
            int actualPort = myNetHandler.StartWithListen(appParams_in.listenPort, appParams_in.listenPortRange);

            if (actualPort <= 0)
            {
                return;
            }
            myName = ":" + actualPort.ToString();
        }
Пример #2
0
        /// Start the clients, connect, process events
        public virtual void Start(AppParams appParams_in)
        {
            // create and connect clients, before starting the loop
            int n    = 3;
            var clis = new NetClientOut[n];

            for (int i = 0; i < n; ++i)
            {
                var nc = new NetClientOut(this, "localhost", appParams_in.listenPort + i, 3 + i);
                clis[i] = nc;
                nc.Start();
            }

            // wait for completions
            for (int i = 0; i < n; ++i)
            {
                clis[i].Join();
            }
            // delete clients
            for (int i = 0; i < n; ++i)
            {
                clis[i] = null;
            }
        }