Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
16 Views

Alarm Clock issue

Hello,

I'm writing one application to control the alarm clock, I create a form and calling "WakeOnInfo()" function (which is the function in SDK example "AlarmClockApi.cs), if I call this function without create another thread, just use the form main thread everything works fine, but the UI will block until the WakeOnInfo finished,then if I create a thread to call the WakeOnInfo() function, there will have two situation that I met:

1.if the remote machine is powered on, then the function called by the thread works fine.

2.if the remote machine is powered off, then I get the exception as below.

"The remote server return an error : (401) Unauthorized"

Can anyone help me to solve this problem, and tell me why? thanks a lot!!

Cary

0 Kudos
2 Replies
Highlighted
Black Belt
16 Views

Hello Cary,

I think the secondbehavior is the strange one because if machine is powered off Alarm clock feature must continue working. Could you try to attemp reconnecting on a try/catch block after exception appears -in the same thread-?

Javier Andrs Cceres Alvis

0 Kudos
Highlighted
Valued Contributor I
16 Views

Hi Cary,

If you're getting a 401 error, then you've got some kind of security issue. In order to receive a 401, the server has to be responding, it just doesn't like the security surrounding your call. Try looking at a wireshark trace of the network traffic and see if you can get some info on the failure. Normally, a 401 error should be very readable in clear text in the HTTP traffic between the client and the server.

Regards,

Roger

0 Kudos