请帮我... [英] please help me...

查看:81
本文介绍了请帮我...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个问题...

我的应用程序中存在与服务器ping通相关的错误.
我在项目中使用了MSDN示例,但我对多个服务器执行ping操作,但我认为这是问题,但我必须这样做.

所以这就是我所做的:
我有一个刷新功能,以显示的形式调用该功能,并在按下按钮时调用它,它会重置我的应用程序变量,并且还应对读取的每个服务器执行ping操作.设置完每个服务器后,它将使用MSDN功能,因此我称它为
.
另一个问题是在应用程序加载中,它应该下载文件,读取文件,然后在其浏览器中设置URL.

我为此使用了一个线程,但是由于这是我的第一次,所以我不知道如何解决它.
自从进度条完全加载,挂起并等待5分钟后几秒钟以来,由于我将这些函数放在线程上,因此我的应用程序开始运行.
但是,其按钮之一无法加载,并且浏览器仍未设置.

http://www.4shared.com/file/wGJE2AkO/PingClient-MSDNSample.htm [ ^ ]

http://www.4shared.com/file/Pd3MODTu/Multi-Realm_Luncher-for_fix_13.htm [ ^ ]

Hello there,

I have a question...

There''s a bug in my application regarding ping with a server.
I used MSDN sample in my project but I ping several servers and I think it''s the matter but I have to do this.

So here''s what I''ve done:
I have a refresh function, called in form shown and in button press, it resets my application variables and also should ping with each server it reads for pinging. After each server set, it use MSDN function, so I call it.

The other problem is in application loading where it should download a file, read it, then set a url in it''s browser.

I use a thread for that but since it''s my first time I don''t know how to fix it.
Since I put these functions on thread my application after several second since progress bar loaded fully, hang, and after 5min come to life again.
However one of its button doesn''t load, and it''s browser still not set.

http://www.4shared.com/file/wGJE2AkO/PingClient-MSDNSample.htm[^]

http://www.4shared.com/file/Pd3MODTu/Multi-Realm_Luncher-for_fix_13.htm[^]

推荐答案

服务器应用程序(尤其是下载线程)需要它可以获得的所有操作系统帮助.尝试卸载某些程序,这应该可以解决下载问题.第一个问题是关于即将重置ping请求.正在进行的ping操作无法像其他任何形式的变量一样快速重置.
The server applications especially the download threads need all the operating system help that it can get. Try offloading some of your programs and that should fix the download problem. The first problem is about being about to reset a pinging request. The ping in progress can''t be reset as quickly as any other form variables.


嘿,

该窗口基本上挂起,因为您正在使用同一线程下载文件以及更新应用程序.

在处理后台工作时,始终建议使用线程 [ ^ ],然后从此处调用download方法.

要ping您可以使用:

Hey,

The window basically hangs because you are using the same thread to download the file as well as updating the application.

When you are dealing with background work, it is always recommended to use Thread [^]and invoke the download method from there.

To ping you might use :

public static bool IsConnectedToInternet
       {
           get
           {
               Uri url = new Uri("yoururl");
               string pingurl = string.Format("{0}", url.Host);
               string host = pingurl;
               bool result = false;
               Ping p = new Ping();
               try
               {
                   PingReply reply = p.Send(host, 3000);
                   if (reply.Status == IPStatus.Success)
                       return true;
               }
               catch { }
               return result;
           }
       }


:thumbsup:


:thumbsup:


我尝试了这个但给了我错误,所以我每个都做一次,均产生错误:''(

public static int Ping(字符串主机名)
{
ping ping = new Ping();

PingReply回复= ping.Send(主机名);
如果(reply.Status == IPStatus.Success)
{
Console.WriteLine(地址:{0}",reply.Address);
Console.WriteLine("RoundTrip时间:{0}",repeat.RoundtripTime);
Console.WriteLine(生存时间:{0}",reply.Options.Ttl);
Console.WriteLine("Don" t Fragment:{0},reply.Options.DontFragment);
Console.WriteLine("Buffer Size:{0}",reply.Buffer.Length);
Console.WriteLine("Status:{0}",reply.Status);

Console.ReadLine();
返回(0);
}
其他
{
Console.WriteLine("Error");
Console.WriteLine("Status:{0}",reply.Status);
Console.ReadLine();
return(1);
}
}
i tried this but gave me error, so i did once per each, egain generate error :''(

public static int Ping(string hostname)
{
Ping ping = new Ping();

PingReply reply = ping.Send(hostname);
if (reply.Status == IPStatus.Success)
{
Console.WriteLine("Address: {0}", reply.Address);
Console.WriteLine("RoundTrip Time: {0}", reply.RoundtripTime);
Console.WriteLine("Time To Live: {0}", reply.Options.Ttl);
Console.WriteLine("Don''t Fragment: {0}", reply.Options.DontFragment);
Console.WriteLine("Buffer Size: {0}", reply.Buffer.Length);
Console.WriteLine("Status: {0}", reply.Status);

Console.ReadLine();
return (0);
}
else
{
Console.WriteLine("Error");
Console.WriteLine("Status: {0}", reply.Status);
Console.ReadLine();
return (1);
}
}


这篇关于请帮我...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆