/** entry point of the application */
        public static void Main()
        {
            wifi = new WiFiESP12F(IO.Port1);
            wifi.reset();
            Thread.Sleep(1000);
            wifi.setWifiMode(WiFiESP12F.wifiMode.SOFTAP);
            wifi.setAP("WifiTest", "Password1", 1, WiFiESP12F.SecurityType.WPA_WPA2_PSK);
            Thread.Sleep(1000);            // Required after calling setAP



#if (UDP)
            wifi.startUDP(4, "192.168.4.2", 11000, 11001);
#endif
#if (TCPServer)
            wifi.openTCPServer(11001);
#endif
#if (TCP)
            wifi.startTCP(0, "192.168.4.2", 11000);
#endif

            /* temporary array */
            byte[] scratch = new byte[1];


            /* loop forever */

            while (true)
            {
                /* read bytes out of uart */
                if (wifi.processInput())
                {
                    /*transfer processed data to cache*/
                    cacheSize = wifi.transferDataCache(_cache);
                    for (int j = 0; j < cacheSize; j++)
                    {
                        PushByte(_cache[j]);
                    }
                }

                /* if there are bufferd bytes echo them back out */
                if (_txCnt > 0)
                {
                    scratch = new byte[_txCnt];
                    PopTX(scratch);


#if (UDP)
                    wifi.sendUDP(4, scratch);
#endif
#if (TCPServer || TCP)
                    wifi.sendTCP(0, scratch); //The '0' id assumes you only have one connection on the TCP server. A list of connections can be obtained using 'AT+CIPSTATUS'.
#endif
                }
            }
        }