当前位置: 首页>>代码示例>>C#>>正文


C# Task.GetPort方法代码示例

本文整理汇总了C#中System.Threading.Task.GetPort方法的典型用法代码示例。如果您正苦于以下问题:C# Task.GetPort方法的具体用法?C# Task.GetPort怎么用?C# Task.GetPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Threading.Task的用法示例。


在下文中一共展示了Task.GetPort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ucinfo

        public void ucinfo()
        {
            Utility utility = new Utility();
             HttpContext postedContext = HttpContext.Current;
             HttpFileCollection Files = postedContext.Request.Files;

             string serverKey = utility.Decode((string)postedContext.Request.Form["serverKey"]);
             string direction = utility.Decode((string)postedContext.Request.Form["direction"]);
             string mac = utility.Decode((string)postedContext.Request.Form["mac"]);
             string imageID = utility.Decode((string)postedContext.Request.Form["imageID"]);

             if (utility.GetSettings("On Demand") == "Enabled")
             {
                 if (serverKey == utility.GetSettings("Server Key"))
                 {
                     Image image = new Image();
                     if (direction == "push")
                     {
                         if (!image.Check_Checksum(imageID))
                         {
                             HttpContext.Current.Response.Write("Client Error: This Image Has Not Been Confirmed And Cannot Be Deployed.");
                             return;
                         }
                     }

                     string storage = null;
                     string imageOS = null;
                     string hostName = null;
                     string hostScripts = null;
                     string hostArgs = null;
                     string serverIP = utility.GetSettings("Server IP");
                     string xferMode = utility.GetSettings("Image Transfer Mode");
                     string compAlg = utility.GetSettings("Compression Algorithm");
                     string compLevel = utility.GetSettings("Compression Level");
                     string imageProtected = null;
                     string imageName = null;
                     string result = null;
                     if (xferMode == "smb" || xferMode == "smb+http")
                         storage = utility.GetSettings("SMB Path");
                     else
                     {
                         if (direction == "pull")
                             storage = utility.GetSettings("Nfs Upload Path");
                         else
                             storage = utility.GetSettings("Nfs Deploy Path");
                     }
                     try
                     {
                         using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
                         {
                             NpgsqlCommand cmd = new NpgsqlCommand("client_customunicastinfo", conn);
                             cmd.CommandType = CommandType.StoredProcedure;
                             cmd.Parameters.Add(new NpgsqlParameter("@imageName", imageID));
                             cmd.Parameters.Add(new NpgsqlParameter("@hostMac", mac));
                             cmd.Parameters.Add(new NpgsqlParameter("@imageOSResult", NpgsqlDbType.Varchar, 100));
                             cmd.Parameters["@imageOSResult"].Direction = ParameterDirection.Output;
                             cmd.Parameters.Add(new NpgsqlParameter("@hostNameResult", NpgsqlDbType.Varchar, 100));
                             cmd.Parameters["@hostNameResult"].Direction = ParameterDirection.Output;
                             cmd.Parameters.Add(new NpgsqlParameter("@hostscripts", NpgsqlDbType.Varchar, 100));
                             cmd.Parameters["@hostscripts"].Direction = ParameterDirection.Output;
                             cmd.Parameters.Add(new NpgsqlParameter("@hostargs", NpgsqlDbType.Varchar, 100));
                             cmd.Parameters["@hostargs"].Direction = ParameterDirection.Output;
                             cmd.Parameters.Add(new NpgsqlParameter("@imageprotected", NpgsqlDbType.Varchar, 100));
                             cmd.Parameters["@imageprotected"].Direction = ParameterDirection.Output;
                             cmd.Parameters.Add(new NpgsqlParameter("@imagename", NpgsqlDbType.Varchar, 100));
                             cmd.Parameters["@imagename"].Direction = ParameterDirection.Output;

                             conn.Open();
                             cmd.ExecuteNonQuery();
                             imageOS = (cmd.Parameters["@imageOSResult"].Value as string);
                             hostName = (cmd.Parameters["@hostNameResult"].Value as string);
                             hostScripts = (cmd.Parameters["@hostscripts"].Value as string);
                             hostArgs = (cmd.Parameters["@hostargs"].Value as string);
                             imageProtected = (cmd.Parameters["@imageprotected"].Value as string);
                             imageName = (cmd.Parameters["@imagename"].Value as string);
                         }

                         result = "imgOS=" + imageOS + " imgName=" + imageName + " hostName=" + hostName + " hostScripts=" + "\"" + hostScripts + "\" " + hostArgs + " storage=" +
                             storage + " serverIP=" + serverIP + " xferMode=" + xferMode + " compAlg=" + compAlg + " compLevel=-" + compLevel + " imageProtected=" + imageProtected;

                         if (direction == "pull" && utility.GetSettings("Image Transfer Mode") == "udp+http")
                         {
                             Task task = new Task();
                             int portBase = task.GetPort();
                             result = result + " portBase=" + portBase;
                         }
                     }
                     catch (Exception ex)
                     {
                         result = "Client Error: Could Not Read Custom Unicast Info.  Check The Exception Log For More Info";
                         Logger.Log(ex.ToString());
                     }
                     HttpContext.Current.Response.Write(result);

                 }
                 else
                 {
                     Logger.Log("An Incorrect Key Was Provided While Trying To List Images");
                 }
             }
//.........这里部分代码省略.........
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:101,代码来源:ClientSvc.asmx.cs


注:本文中的System.Threading.Task.GetPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。