【问题标题】:C# Pinging particular ports and proxy credentialsC# Ping 特定端口和代理凭据
【发布时间】:2010-07-16 09:19:20
【问题描述】:

我有 2 个问题要问你。

我正在创建一个依赖于 Jabber 的聊天应用程序,我的服务器是服务器端的端口 5222。

端口 Ping

如何通过端口 5222 ping 服务器并检查其是否打开和响应。

类似Ping.Once(Settings.Defualt.ChatServerDomain,Settings.Defualt.ChatServerPort);

代理认证

在我的工作中,由于我们运行的代理服务器,我的应用程序无法登录,在 IE 中,您可以设置代理设置以允许所有常规应用程序连接,但我的应用程序不使用这些设置。

所以我需要做的是创建一个小检查器来查看是否在代理服务器后面,以及我们是否显示一个窗口来验证用户凭据。并将应用程序绑定到它们的凭据,以便在应用程序打开期间对任何请求进行身份验证。

这就是我在编码术语中的意思

if(ProxyAuthRequired())
{
    ProxyAuthWindow ProxyAuthWindow = new ProxyAuthWindow();
    CurrentWindow.Enable = false;
    /*
     * Within the Form ProxyAuthWindow, This will callback to my main controller after
     * The auth is checked and ok, This is what i do not know how to do
     */
    ProxyAuthWindow.Show(); //Ask for the credentials and check the port inside here
}

【问题讨论】:

  • 请把这个问题分成两个问题。
  • 确实有同样的问题,连接到服务器,并对服务器进行身份验证。我不介意把它们分开

标签: c# proxy port ping authentication


【解决方案1】:
  1. 对于 Ping:尝试 Ping

  2. 以下是check and set the proxy 凭据的方法。

【讨论】:

  • @Robert:我认为你必须使用System.Net.Socket,例如TcpClient 类,来尝试连接到特定的IP/端口,看看你是否能够连接或获得异常。
  • 谢谢分配,这正是我需要的:)
猜你喜欢
  • 2018-05-09
  • 2013-07-31
  • 1970-01-01
  • 1970-01-01
  • 2013-03-04
  • 1970-01-01
  • 1970-01-01
  • 2014-01-30
  • 1970-01-01
相关资源
最近更新 更多