在Web Service调用程序
来源:互联网 发布:程序员看不懂英文文档 编辑:程序博客网 时间:2024/05/16 17:40
[WebMethod]
public string HelloWorld()
{
string m_strHost="10.12.34.101" ;
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
string pingrst = string.Empty;
process.StartInfo.Arguments = "ping " + m_strHost + " -n 1";
process.Start();
process.StandardInput.AutoFlush = true;
string temp = "ping " + m_strHost + " -n 1" ;
process.StandardInput.WriteLine(temp);
process.StandardInput.WriteLine("exit");
string strRst = process.StandardOutput.ReadToEnd();
if(strRst.IndexOf("(0% loss)")!=-1)
pingrst = "连接";
else if( strRst.IndexOf("Destination host unreachable.")!=-1)
pingrst = "无法到达目的主机";
else if(strRst.IndexOf("Request timed out.")!=-1)
pingrst = "超时";
else if(strRst.IndexOf("Unknown host")!=-1)
pingrst = "无法解析主机";
else
pingrst = strRst;
process.Close();
return pingrst+m_strHost;
}
public string HelloWorld()
{
string m_strHost="10.12.34.101" ;
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
string pingrst = string.Empty;
process.StartInfo.Arguments = "ping " + m_strHost + " -n 1";
process.Start();
process.StandardInput.AutoFlush = true;
string temp = "ping " + m_strHost + " -n 1" ;
process.StandardInput.WriteLine(temp);
process.StandardInput.WriteLine("exit");
string strRst = process.StandardOutput.ReadToEnd();
if(strRst.IndexOf("(0% loss)")!=-1)
pingrst = "连接";
else if( strRst.IndexOf("Destination host unreachable.")!=-1)
pingrst = "无法到达目的主机";
else if(strRst.IndexOf("Request timed out.")!=-1)
pingrst = "超时";
else if(strRst.IndexOf("Unknown host")!=-1)
pingrst = "无法解析主机";
else
pingrst = strRst;
process.Close();
return pingrst+m_strHost;
}
- 在Web Service调用程序
- 在ASP程序中调用Web Service
- 在ASP程序中调用Web Service
- 在ABAP程序中调用Web Service
- 使用 Integrated Web Services Client for ILE 在 ILE 程序中调用 Web Service
- 桌面程序调用Web Service应用实例
- web程序中在jsp中调用spring 容器下的service
- web service在远程不能调用
- 在Web Service中调用继承对象
- 在web service 中的android调用soap
- Ajax程序:处理异步调用中的异常(在客户端调用Web Service代理时发生异常的处理办法)
- 在 web project 中的 jsp 程序中 使用 Web Service
- iphone sdk xcode程序中如何调用web service (wsdl)
- 动态调用Web Service
- js调用web service
- Web Service 异步调用
- 调用 Web Service 示例
- ASP 调用 web service
- XDoclet 学习笔记
- XML的五种用途~
- Win2000移花接木两例
- 了解XML文档对象模型
- 暖夏
- 在Web Service调用程序
- 8月5日游成都武侯祠
- [zt] 北大拒绝丘成桐的批评标志着中国将成为羞耻感荡然无存的社会
- ASP 内建对象速查卡
- 移动会扼杀独立wap吗
- javascriot学习-第五章 DOM编程
- javascriot学习-第六章 脚本编程的相关技术
- 如何优化JAVA程序开发,提高JAVA性能
- 真是气死我了