Reputation: 1786
I am writing an app to connect to a third party application using REST web services.
I have a configuration page that asks for an IP, Port, User Name & Password, currently it just blindly assumes you enter the correct details and attempts a connection.
I want to create a test routine that goes through and checks off the following steps when setting up the config information
then displays the results on screen as it's going so that if it can't connect to the service it's easier to identify where the issue is.
To achieve step 1 I would like to use Ping or some equivalent that does not rely on a particular port being open. So I can eliminate dodgy DNS or a typo in the IP/Hostname.
I understand from previous questions asked that ping wasn't possible in 7.0 but with Mango the sockets classes have been added in, is it possible now, if so how? If it still isn't possible is there a different way I can achieve step 1?
Upvotes: 3
Views: 487
Reputation: 1786
I've done a bit more digging, and it looks like this isn't possible with the current 7.1.1 sdk because the sockets implementation doesn't support sending raw datagrams.
I found an article on how to do it in C# for Windows .Net but the socket options don't exist (as far as I could see) in WP7.
Fingers crossed for the 7.8 sdk instead.
Upvotes: 0
Reputation: 660
For 1) and 2) you can definately do with the Mango SDK. There is a App by Microsoft Research called TestMyNet (search in Marketplace or look here: http://research.microsoft.com/en-us/projects/testmynet1/) which does this and more.
For 3) you can listen to the HTTP respose (e.g. Access denied errors).
I will post some code for 1) and 2) later on, if I manage.
Upvotes: 1
Reputation: 65564
Could you use a HTTP HEAD
to check a connection to the server before submitting?
In terms of overall performance I'd only try testing a connection after a request has failed (and depending on the HTTP response code).
Adding extra checks before making the HTTP POST
will only delay the total time of a valid submission.
Upvotes: 0