예제 #1
0
        private static string root = @"\WINFS"; // \\NAND

        #endregion Fields

        #region Methods

        public static void Main()
        {
            httpServer = new HttpServer();
            httpServer.OnGetRequest += new GETRequestEventHandler(httpServer_OnGetRequest);
            //httpServer.Start("http", -1);
            httpServer.Start("http", 81);

            WSServer wss = new WSServer(12000);//, "http://localhost:81", "ws://localhost:2013");
            wss.Start();

            //NameService ns = new NameService(); // Declare as global, name service will stop once the object gets disposed
            //ns.AddName("Typhoon", NameService.NameType.Unique, NameService.MsSuffix.Default); // register your fez as FEZCOBRA on the local network

            //DbTest();

            Thread.Sleep(Timeout.Infinite);
        }
예제 #2
0
        private void InitNetwork()
        {
            //discoveryListener = new DiscoveryListener();

            tcpServer = new TcpServer(Options.IPPort);
            tcpServer.SessionConnected += Session_Connected;
            tcpServer.SessionDataReceived += Session_DataReceived;
            tcpServer.SessionDisconnected += Session_Disconnected;

            wsServer = new WSServer(Options.WSPort);
            wsServer.SessionConnected += Session_Connected;
            wsServer.SessionDataReceived += Session_DataReceived;
            wsServer.SessionDisconnected += Session_Disconnected;

            httpServer = new HttpServer();
            httpServer.OnRequest += httpServer_OnRequest;
            httpServer.OnGetRequest += httpServer_OnGetRequest;
            httpServer.OnResponse += httpServer_OnResponse;

            //if (options.UseWiFi)
            networkManager = new GadgeteerWiFiManager(HWConfig.WiFi, options.WiFiSSID, options.WiFiPassword);
            //else
            //networkManager = new GadgeteerEthernetManager(HWConfig.Ethernet);

            networkManager.Started += new EventHandler(Network_Started);
            networkManager.Stopped += new EventHandler(Network_Stopped);

            StartNetwork();
        }
예제 #3
0
        private void InitNetwork()
        {
            //tcpServer = new TcpServer(Settings.IPPort);
            //tcpServer.SessionConnected += Session_Connected;
            //tcpServer.SessionDataReceived += Session_DataReceived;
            //tcpServer.SessionDisconnected += Session_Disconnected;

            discoveryListener = new DiscoveryListener(Settings.UDPPort, "AquaExpert");

            wsServer = new WSServer(Settings.WSPort);
            wsServer.SessionConnected += Session_Connected;
            wsServer.SessionDataReceived += Session_DataReceived;
            wsServer.SessionDisconnected += Session_Disconnected;

            httpServer = new HttpServer();
            httpServer.OnRequest += httpServer_OnRequest;
            httpServer.OnGetRequest += httpServer_OnGetRequest;
            httpServer.OnResponse += httpServer_OnResponse;

            //if (!Utils.StringIsNullOrEmpty(Settings.WiFiSSID))
                //networkManager = new WiFiManager(wifiRS21.Interface, settings.WiFiSSID, settings.WiFiPassword);
            networkManager = new EthernetManager(ethernetENC28.Interface);
            networkManager.Started += new EventHandler(Network_Started);
            networkManager.Stopped += new EventHandler(Network_Stopped);
            
            timerNetworkOff = new Gadgeteer.Timer(500);
            timerNetworkOff.Tick += delegate(Gadgeteer.Timer t) { SetLed(Leds.Network, !GetLed(Leds.Network)); };
            timerNetworkOff.Start();

            new Thread(() => { networkManager.Start(); }).Start();
        }