C
chook.harel
Is there a way to know on the terminal if it is connected to a computer
host?
(like the opposite way RAPI connected...)
host?
(like the opposite way RAPI connected...)
This is the code I'm using.....Is there a way to know on the terminal if it is connected to a computer
host?
(like the opposite way RAPI connected...)
private bool InternetIsConnected
{
get
{
bool ret = false;
try
{
string HostName = Dns.GetHostName();
if (HostName.StartsWith("Pocket"))
{
IPHostEntry thisHost = Dns.GetHostEntry(HostName);
string thisIpAddr = thisHost.AddressList[0].ToString();
ret = thisIpAddr != IPAddress.Parse("127.0.0.1").ToString();
// If true then the emulator is on the cradle/network so check for internet
if (ret)
{
HostName = "yourwebsite.com"; ///use a known wwebsite
thisHost = Dns.GetHostEntry(HostName);
thisIpAddr = thisHost.AddressList[0].ToString();
ret = thisIpAddr == IPAddress.Parse("xxx.xxx.xxx.xxx").ToString(); //use known IPaddress
}
}
else //Looks like this is a live device
{
ret = true;
}
}
catch
{
lInternetStatus.Text = "Internet offline";
return false;
}
if (ret)
{
lInternetStatus.Text = "Internet connected";
}
lInternetStatus.Refresh();
return (this.OnLine = ret);
}
}