如何从Z机器/服务器检查X服务器和Y服务器之间的网络连接(在这里运行我的代码) [英] how to check the network connectivity between the X server and Y server from the Z machine/server (here my code runs)

查看:75
本文介绍了如何从Z机器/服务器检查X服务器和Y服务器之间的网络连接(在这里运行我的代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
如何从另一台机器(Z机器)检查服务器之间的网络连接(让它是X服务器和Y服务器).即,如果我将源IP和目标IP作为参数,则我需要获取结果,无论这些服务器是否在其中都可以访问.
请帮忙.

Hi all,
How to check the network connectivity between servers(let it be X server and Y server) from the another machine (Z machine). i.e if I give the source IP and destination IP as parameter, i need to get the result whether those servers are reachable within them or not.
Please help.

推荐答案

简短的答案是你不能.

仅仅因为您可以ping服务器X和服务器Y并不意味着它们之间存在路由.您不能为ping指定源地址.即使可以,重做也会返回到源地址,而不是在第三台计算机上运行的代码.

长答案是可以的,只要其中一台服务器正在运行Windows.您可以远程实例化Win32_PingStatus类,并让它为您将ping发送到另一台服务器,并报告返回的信息.

可以在此处找到Win32_PingStatus上的文档. ^ ].
The short answer is you can''t.

Just because you can ping server X and Server Y does not mean that there is a route between them. You cannot specify a source address for a ping. Even if you could, the repoly would go back to the source address, not your code running on a third machine.

The long answer is you can, so long as one of the servers is running Windows. You can remotely instantiate the Win32_PingStatus class and have it send the ping to the other server for you and report back what it gets.

The docs on Win32_PingStatus can be found here[^].




有很多可能性可以检查.
-手动Ping到服务器并检查结果
-使用PingReply Class
http://msdn.microsoft.com/de-de/library/system. net.networkinformation.pingreply.aspx [ ^ ]
-使用System.Net.WebRequest类并检查响应值
-执行HEAD-Request

仅有几种解决方法,我将使用PingReply或System.Net.WebRequest.

致以最诚挚的问候

比约恩
Hi,

there are so much possibilities to check this.
- PING manually to server and check result
- use PingReply Class
http://msdn.microsoft.com/de-de/library/system.net.networkinformation.pingreply.aspx[^]
- use the System.Net.WebRequest Class and also check response value
- do a HEAD-Request

Just a few ways to handle this, I would take PingReply or System.Net.WebRequest.

With Best Regards

Björn


这篇关于如何从Z机器/服务器检查X服务器和Y服务器之间的网络连接(在这里运行我的代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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