Reputation: 397
I am writing Windows Phone
applications which needs to stay connected to the server (precisely speaking windows service application). I want to ping server, llet's say, every 1 second to catch disconnections, etc.
In addition I have to point that I am using Windows Phone SilverLight 8.1
project (I can't do this in normal Windows Phone 8.1
because of Socket
class that is not included)
The fastest way I have found so far is to use Ping
class from System.Net.NetworkInformation
. The thing is that visual studio says there's no Ping
class.
Ok, MSDN documentation doesn't mention Windows Phone SilverLight 8.1
as supported platform. But When I created test Windows Phone 8.1
project visual again said that Ping
doesn't exist.
Here is MSDN documentation page:
and here are supported platforms:
Platforms:
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
Why can't I use Ping class?
If that isn't my fault (like missing assembly, etc.), how can I "ping" my server application in different way?
Upvotes: 1
Views: 2608
Reputation: 3438
You are looking for wrong System.Net.Information implementation. The one you linked is desktop .NET version. For right one you need to look at Silverlight .NET class library: https://msdn.microsoft.com/en-us/library/3ew4thdx(v=VS.95).aspx
Ping is not available at Silverlight, but you can implement own ping command with Windows.Network.Sockets:
Upvotes: 1