public void SetAppPort(string protoString)
    {
        try
        {
            switch (protoString)
            {
            case "tcp":
                selectedProto = LProto.L_PROTO_TCP;
                mxi.GetAppPort(selectedProto);
                break;

            case "http":
                selectedProto = LProto.L_PROTO_HTTP;
                mxi.GetAppPort(selectedProto);
                break;

            case "udp":
                selectedProto = LProto.L_PROTO_UDP;
                mxi.GetAppPort(selectedProto);
                break;
            }
        }
        catch (AppPortException)
        {
            errorPanel.SetActive(true);
            errorText.text = "Error in GetAppPort, check the Console for more details";
            return;
        }
    }
        /// <summary>
        /// Wrapper for Get[]AppPorts. This will return the AppPort object mapped to the given port.
        /// If no port is given, this will return the first AppPort in the dictionary
        /// </summary>
        /// <param name="proto">LProto protocol (L_PROTO_TCP, L_PROTO_UDP, or L_PROTO_HTTP)</param>
        /// <param name="port">port for developer specific backend service</param>
        /// <returns>AppPort</returns>
        public AppPort GetAppPort(LProto proto, int port = 0)
        {
            if (latestFindCloudletReply == null)
            {
                Debug.LogError("MobiledgeX: Last FindCloudlet returned null. Call FindCloudlet again before GetAppPort");
                throw new AppPortException("Last FindCloudlet returned null. Call FindCloudlet again before GetAppPort");
            }

            Dictionary <int, AppPort> appPortsDict = new Dictionary <int, AppPort>();

            switch (proto)
            {
            case LProto.L_PROTO_TCP:
                appPortsDict = matchingEngine.GetTCPAppPorts(latestFindCloudletReply);
                break;

            case LProto.L_PROTO_UDP:
                appPortsDict = matchingEngine.GetUDPAppPorts(latestFindCloudletReply);
                break;

            default:
                throw new AppPortException(proto + " is not supported");
            }

            if (appPortsDict.Keys.Count < 1)
            {
                Debug.LogError("MobiledgeX: Please make sure you defined the desired Ports in your Application Port Mapping Section on MobiledgeX Console.");
                throw new AppPortException("No AppPorts available for your Application");
            }

            if (port == 0)
            {
                Logger.Log("No port specified. Grabbing first AppPort in dictionary");
                port = appPortsDict.OrderBy(kvp => kvp.Key).First().Key;
            }

            try
            {
                AppPort appPort = appPortsDict[port];
                latestAppPort = appPort;
                return(appPort);
            }
            catch (KeyNotFoundException)
            {
                Debug.LogError("MobiledgeX: Port supplied is not mapped for your Application, Make sure the desired port are defined in your Application Port Mapping Section on MobiledgeX Console.");
                throw new AppPortException(proto + " " + port + " is not defined for your Application");
            }
        }