ActiveSync question

  • Thread starter Thread starter chook.harel
  • Start date Start date
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...)
 
Try to resolve the "PPP_PEER" host address - if it resolves (it will be
192.168.55.1 IIRC) then you're connected.

-Chris
 
Thanks for the information, though I really have no clue about
how to implement this in the code
(using C#)

if you could write it in two lines ;) i would be very greatful
 
Use something like the following:

IPHostEntry entry = Dns.GetHostEntry("ppp_peer");
if (entry != null)
{
//Then you're connected.
}

Simon.
 
Is there a way to know on the terminal if it is connected to a computer
host?
(like the opposite way RAPI connected...)
This is the code I'm using.....

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);
}
}

Cheers

Will Chapman
 
Back
Top