Exemplo n.º 1
0
        /// <summary>
        /// Start the server
        /// </summary>
        public void startServer()
        {
            if (!serverStarted) //Start fisrt time
            {
                Receiver receiver = new Receiver();
                //Event on data reveived
                receiver.OnReceived += new Receiver.received(r_OnReceived);
                receiver.StartReceiver(listenPort);

                /*Get IP Address*/
                MyIPAddress myIPAddress = new MyIPAddress();
                if (myIPAddress.GetIPAddress(listenPort))
                {
                    /*Send the broadcast with all IP of server*/
                    sendBroadcast(serverIPs);
                }
                serverStarted = true;
            }
            else //Send only a broadcast
            {
                sendBroadcast(serverIPs);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Start the server
        /// </summary>
        public void startServer()
        {
            if (!serverStarted) //Start fisrt time
            {
                Receiver receiver = new Receiver();
                //Event on data reveived
                receiver.OnReceived += new Receiver.received(r_OnReceived);
                receiver.StartReceiver(listenPort);

                /*Get IP Address*/
                MyIPAddress myIPAddress = new MyIPAddress();
                if (myIPAddress.GetIPAddress(listenPort))
                    /*Send the broadcast with all IP of server*/
                    sendBroadcast(serverIPs);
                serverStarted = true;
            }
            else //Send only a broadcast
                sendBroadcast(serverIPs);
        }