Rising an event during a SOAP request

Hi all,

I am developing a web application interacting with Gadgeteer.
For some project constraints I have to base the communication on SOAP over https (written by means of WCF).

“Thanks” to encryption slowness I managed to do some tests and I’ve found out that if I remove the ETH cable during a SOAP request the Gadgeteer is stuck and it waits for a SOAP message for ages.

What I need is a way to notify the network fault, all the solutions proposed in the forum that I’ve read haven’t solved my problem :frowning:

Does anyone have any suggestion?

I tried to:
use a GT.timer in the main thread,
start the SOAP request method in a secondary thread setting a GT:timer in the main thread,
use ExecutionConstraint,
find a way to set the timeout from the proxy

Now I have no idea about what I should do…

That’s right, I forgot to list such events in the previous post.
Neither network up nor network down events are able to stop SOAP request message read, is there a programmable priority aware interrupt that I can use?

@ cyberh0me - Network availability interrupt does not fire if I remove the cable when the Gadgeteer is waiting for a SOAP response from the server, however it can be raised in any other moment.
I don’t understand such a behavior, is it normal?

@ DavideXX92 - without having tested, I would think that the events should come if the SOAP http request really runs in a separate thread. You should show your code and tell which mainboard and which network module you are using.

@ RoSchmi - I use ethernetJ11D module and the Mainboard is Spider 2.0
Following the example code I’m testing


void camera_PictureCaptured{
                ....
                try {
                    Thread t = new Thread(request);
                    t.Start();
                    for (int i = 0; i < 5; i++) {
                        Debug.Print("Hello I'm the thread 1");
                        Thread.Sleep(2000);
                    }
                }
                catch (Exception e)
                {
                    Debug.Print("Error with the network, unable to send the photo to server");
                    Debug.Print("Exception:" + e.Message);
                    showStatus(Status.sendImageError);
                }
}

 void request() {
            try {
                Debug.Print("Requesting port to web service...");
                //Thread.Sleep(30000);
                int port = getPort();
           .....
}

If I remove the ETH cable when the getPort() proxy method starts, the initial thread is not able to print all the Debug(“Hello I’m the thread 1”), it is like the initial thread is not scheduled anymore…
On the contrary the schedulation is correct during the sleep of the second thread.

@ DavideXX92 - not easy to guess without knowing the code of the request method. I think that there will occure an exception when the cable is pulled and perhaps this is not handled properly.
Perhaps someone else knows the reason.