यह सब एक घंटे पहले और कई दिन पहले काम कर रहा था। लिंक मैं पिंग करने का प्रयास करते है:मुझे पिंगएक्सप्शन क्यों मिल रहा है?
nc = new NetworkConnection();
bool bval = nc.PingConnection(satellite_address);
if (bval)
{
label19.Visible = true;
label19.Text = "Internet Access";
}
else
{
label19.Visible = true;
label19.Text = "No Internet Access";
}
जब यह इस लाइन पर अमल करने की कोशिश कर रहा है::
bool bval = nc.PingConnection(satellite_address);
यह जा रहा है
यह Form1 में कोड है nc
वर्ग:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.NetworkInformation;
using System.IO;
using System.Windows.Forms;
namespace mws
{
class NetworkConnection
{
public NetworkConnection()
{
}
public bool PingConnection(string url)
{
bool Result = false;
using (Ping pp = new Ping())
{
byte[] buffer = Encoding.ASCII.GetBytes("samplestring");
int timeout = 120;
try
{
PingReply reply = pp.Send(url, timeout, buffer);
if (reply.Status == IPStatus.Success)
Result = true;
}
catch (Exception)
{
Result = false;
}
}
return Result;
}
}
}
nc कक्षा में जब लाइन करने का प्रयास कर:
PingReply reply = pp.Send(url, timeout, buffer);
यह कैच ब्लॉक पर कूद रहा है और एक PingException फेंकता है:
के दौरान हुईएक अपवाद एक पिंग अनुरोध
और उसके बाद फॉर्म 1 में परिणाम यह है कि इंटरनेट एक्सेस नहीं है लेकिन इंटरनेट है और मैं यूआरएल में कोई समस्या नहीं डाल सकता।
यह पूरा अपवाद संदेश है:
System.Net.NetworkInformation.PingException was caught
HResult=-2146233079
Message=An exception occurred during a Ping request.
Source=System
StackTrace:
at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer)
at mws.NetworkConnection.PingConnection(String url) in d:\C-Sharp\Download File\Downloading-File-Project-Version-012\Downloading File\NetworkConnection.cs:line 33
InnerException: System.Net.Sockets.SocketException
HResult=-2147467259
Message=No such host is known
Source=System
ErrorCode=11001
NativeErrorCode=11001
StackTrace:
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
InnerException:
लाइन 33 है:
PingReply reply = pp.Send(url, timeout, buffer);
क्या कारण है कि यह अपवाद दिखाई हो सकता है? इससे पहले कि यह कार्यक्रम अब कुछ कार्यक्रमों के लिए काम कर रहा है, यह पहले दिखाई नहीं दे रहा था।
और मुझे इसे कैसे या कैसे संभालना चाहिए?
क्या आप प्रॉक्सी के पीछे हैं? – Yahya
याहा संख्या। मैं पीछे नहीं हूँ – user3596190
लाइन 33 समस्या समस्या समस्या पिंग अनुरोध में है। –