Start() public method

public Start ( ) : void
return void
示例#1
0
        private void StartServer()
        {
            if (!serverIsStarted)
             {
            if (networkNode != null)
            {
               networkNode = null;
            }
            networkNode = new NetworkNode(CurrentServerData.id, IPAddress.Any, SensorShareConfig.CommunicationPort);
            aliveTimer = new System.Threading.Timer(new System.Threading.TimerCallback(SendAliveMessage), null, 0, SensorShareConfig.AliveTimeout);

            networkNode.MessageReceived += new MessageEventHandler(networkNode_MessageReceived);
            networkNode.Start();

            serverIsStarted = true;
            MessageBox.Show(String.Format("Started for {0}", CurrentServerData.id));
            log.Append("StartServer", String.Format("Started for {0}", CurrentServerData.id));
             }
             if (this.InvokeRequired)
             {
            this.Invoke(descriptionUpdater);
             }
             else
             {
            UpdateServerDescription();
             }
        }