Пример #1
0
        public void StartHosting()
        {
            try
            {
                if (IsHosting)
                {
                    HostedServer.Stop();
                    SyncTimer.Stop();
                }

                HostedServer = new Server(HostPort);
                HostedServer.Start();
                HostedServer.Input += OnHostInput;
                HostedServer.Output += OnHostOutput;
                HostedServer.Connect += OnHostConnect;
                HostedServer.Disconnect += OnHostDisconnect;
                SyncTimer.Start();
            }
            catch (Exception e)
            {
                StopHosting();
                Debug.Log(e);
            }
        }
Пример #2
0
 private void OnLoad(object sender, EventArgs e)
 {
     Server = new Server(25564);
     Server.Start();
 }