你的位置:首页 > 软件开发 > ASP.net > net实现ping的方法

net实现ping的方法

发布时间:2016-02-01 09:00:06
class ServicePinger { private static readonly ILog log = LogManager.GetLogger(typeof(ServicePinger)); public ServicePinger(string sit ...
class ServicePinger  {    private static readonly ILog log = LogManager.GetLogger(typeof(ServicePinger));    public ServicePinger(get='_blank'>string siteName, string siteUrl, string serviceUrl)    {      if (siteName == null)        throw new ArgumentException("siteName can't be null");       if (siteUrl == null)        throw new ArgumentException("siteUrl can't be null");       if (serviceUrl == null)        throw new ArgumentException("serviceUrl can't be null");       if (siteName.Length == 0)        throw new ArgumentException("siteName can't be empty");       if (siteUrl.Length == 0)        throw new ArgumentException("siteUrl can't be empty");       if (serviceUrl.Length == 0)        throw new ArgumentException("serviceUrl can't be empty");       pingingSiteName = siteName;      pingingSiteUrl = siteUrl;      serviceUrlToPing = serviceUrl;      }     private string pingingSiteName = string.Empty;    private string pingingSiteUrl = string.Empty;    private string serviceUrlToPing = string.Empty;    private int timeoutInMilliseconds = 3000;     /// <summary>    /// Does the actual pinging of the service    /// </summary>    public void Ping()    {      try      {        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceUrlToPing);        request.Method = "POST";        request.ContentType = "text/

原标题:net实现ping的方法

关键词:net

net
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。