Пример #1
0
        public ServerConnection(string hostIP, int port, ReceiveBuffer receiveBuffer)
        {
            this.receiveBuffer = receiveBuffer;
            this.ip            = IPAddress.Parse(hostIP);
            this.ipEnd         = new IPEndPoint(ip, port);

            connectThread = new Thread(new ThreadStart(SocketReceiveLoop));
            connectThread.Start();
        }
Пример #2
0
        IEnumerator Start()
        {
            receiveBuffer    = new ReceiveBuffer();
            serverConnection = new ServerConnection(config.hostIP, config.port, receiveBuffer);

            // wait other module to init
            yield return(null);

            entityManager = EntityManager.instance;

            StartCoroutine(ConnectionCheckLoop());
            StartCoroutine(MessageCheckLoop());
            StartCoroutine(SyncLocalToServerLoop());
        }