TC app does not reconnect to the server.

Topics related to the TouchControl Server software.
Post Reply
fxwegr
Posts: 16
Joined: Wed Dec 14, 2016 3:40 pm

TC app does not reconnect to the server.

Post by fxwegr » Wed Feb 15, 2017 7:33 pm

Hi Dave,
when I suspend my windows system (S3) using a TC activity, and I do not leave the activity window, then I can wake up the PC using a WOL command, but not suspend the WIN PC again.

The TC app loses the connection to my router. It looks like a reconnect problem. In the documentation I find some hints for a solution, but these are not very clear for me.

For example, in the illustrated reconnect script, is the word "button" a key word which is interpreted by the TC app, or is that a normal variable like for example "_global.myVar"? Can you give me some advice how to create a working reconnect script?

Thank you in advance.

User avatar
Dave
Site Admin
Posts: 79
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: TC app does not reconnect to the server.

Post by Dave » Thu Feb 16, 2017 4:03 am

Hi fxwegr. Sorry for the lack of clarity on that documentation. The disconnect and reconnect script handlers are really meant for sockets associated with feedback client buttons. The parameters of the functions are supplied by TouchControl when it calls the functions. So you supply a function with the signature myReconnectFunction(button, host, port), and then within your function the "button" parameter contains the name of the feedback client button that is associated with socket, the "host" param contains the IP address, and the "port" param contains the bound port. Since feedback client buttons are basically always listening in the background, these handler functions give you a way to be notified when the socket is disconnected, and/or when it reconnects. With that said, a reconnect handler function can get called under certain circumstances for normal EventTrigger button interactions as well, and in that case the button parameter will be null, but the host and port will be populated with info about the remote device you are trying to connect to. However, usually EventTrigger buttons aggressively try to reconnect with broken connections on their own, if the remote device is still available on the network, so these scripts aren't useful.

Regardless, in your case, I don't think this is going to help you anyway. One reason is because wake on lan uses the UDP protocol, so there really isn't a "connected" socket that can be reconnected. TC just boroadcasts the WOL packet out on your network via UDP. Also, a connection to your router isn't a "connection" that TC maintains, it simply uses whatever connection is available on your device. And since WOL is uses UDP, your device doesn't really have to have a connection to anything specific, other than just being connected to your network so that it can broadcast out the WOL message to any device that might be listening.

So can you tell me why you think TC is losing a connection? Is your iOS device actually losing its connection? Are you receiving any connection or other types of errors from TC when you execute the WOL button? You mention that you can wake up the PC again if you do not leave the activity window. Does the problem only occur when you exit the activity and then re-enter the activity and try again? Or if you close TC and then open it back up and try again? If you can give me the exact steps you are taking that causes the problem, I can try to reproduce the problem on my end. And sorry what is S3?

fxwegr
Posts: 16
Joined: Wed Dec 14, 2016 3:40 pm

Re: TC app does not reconnect to the server.

Post by fxwegr » Thu Feb 16, 2017 6:22 pm

First: S3 is one of the Windows power states. S3 equals to sleep/suspend. For more information look here:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

OK I will try to describe the faulty process as exactly as possible. I try it with a textual description:

1.)
I start on my Windows PC the TC server. Using the “TCPView” tool from Mark Russinovich I see that the server establishes the following connections:

Process.................PID....Protocol...Local Adr............. Port.....Remote Adr.......Remote Port....State
TouchControl.exe.....8168..TCP.........Orpheus..............8823....Orpheus...........0.................LISTENING
TouchControl.exe.....8168..TCP.........Orpheus..............9744....localhost..........5354.............ESTABLISHED

Orpheus is the server running the TC-Server application.

2.)
On my iPad I start the TC app. TCPView shows me now the following connections:

Process.................PID....Protocol...Local Adr............. Port.....Remote Adr.......Remote Port....State
TouchControl.exe.....8168..TCP.........Orpheus..............8823....Orpheus...........0.................LISTENING
TouchControl.exe.....8168..TCP.........Orpheus..............9744....localhost..........5354.............ESTABLISHED
TouchControl.exe.....8168..TCP.........orpheus.fritz.box...8823....192.168.178.10..49201............ESTABLISHED
192.168.178.10 is the IP address of my iPad.

3.)
With the TC app, using an ET button, I suspend the WIN-PC (TC-Server). The ET-Button sends an 'suspend system' command to the serverside residing EventGhost application. I d'ont leave the TC activity window! The TC-server suspended together with the whole WIN-System.

4.)
I wake up the WIN-PC (TC-Server) using an ET button instrumented with an WOL command. This works fine but
TCPView shows me now the following connections:

Process.................PID....Protocol...Local Adr............. Port.....Remote Adr.......Remote Port....State
TouchControl.exe.....8168..TCP.........Orpheus..............8823....Orpheus...........0.................LISTENING
TouchControl.exe.....8168..TCP.........Orpheus..............9744....localhost..........5354.............ESTABLISHED

The third connection to 192.168.178.10 was not reestablished and a subsequent powerdown command issued with the TC app (iPad) is not executed.

As far as the description of the problem. I hope I could make myself understood, if not please put your questions.

With my best regards

User avatar
Dave
Site Admin
Posts: 79
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: TC app does not reconnect to the server.

Post by Dave » Thu Feb 16, 2017 7:32 pm

Ok sorry I misunderstood your original question. I did not understand that there was an additional socket connection to EventGhost involved. What you are seeing with the connections is correct. If a remote host that TC is connected to goes away (i.e. your PC goes to sleep), that connection will be broken (obviously). Just having that host return to the network will not make TC automatically re-connect to it. TC doesn't constantly poll the network for hosts that it was at one time connected to, so TC won't know when it comes back on the network. However, when you re-execute a button that uses that host (your EventTrigger button that executes the Event Ghost command), TC should then see the the connection is broken, and attempt to re-connect to the host (your PC), and then send the command. If it cannot connect immediately, it should retry at least a couple of times and you should see a "Connecting..." message on your iPad. Are you seeing that message? If it is unable to connect on the first tap of the button, then you should eventually get a connection error after it has finished re-trying. Are you seeing that message? If so, if you then tap the button a second time, does it connect successfully and send the command to Event Ghost? Or does it always then return a connection error at that point? And if so, does closing the activity and re-opening then allow it to re-establish the connection, or do you have to kill TC and restart it to get it to reconnect, or what do you have to do from there?

fxwegr
Posts: 16
Joined: Wed Dec 14, 2016 3:40 pm

Re: TC app does not reconnect to the server.

Post by fxwegr » Fri Feb 17, 2017 1:31 pm

Here is some more information about what I do in the activity:

I have defined a power toggle button which executes in state 1 (power on) an AHK button and executes in state 2 (power off) an ET button. The AHK button is instrumented with an WOL command. The ET button sends an power off event to EventGhost.

I can reproduce the problem doing the following steps:
1. Starting from scratch and pressing the activity power button executes the WOL command and wakes up the server from S3. This always works well.

2. I press the power button again, now the ET button is executed and the the server is send to S3 (sleep). This always works well.

3. I press the power button again, the AHK button is executed with its WOL command and wakes up the server from S3 using the UDP protocoll. This always works well.

4. I press the power button again, the ET button is executed sends the 'power down' event event to eventghost but fails because there is no TCP connection to the server.

To your questions:
<<
However, when you re-execute a button that uses that host (your EventTrigger button that executes the Event Ghost command), TC should then see the the connection is broken, and attempt to re-connect to the host (your PC), and then send the command. If it cannot connect immediately, it should retry at least a couple of times and you should see a "Connecting..." message on your iPad. Are you seeing that message?
>>
No, I see no message but It takes a few (about 10) seconds until the POSt script is executed.

<<
If it is unable to connect on the first tap of the button, then you should eventually get a connection error after it has finished re-trying. Are you seeing that message?
>>
No, no message is displayed.

<<
If so, if you then tap the button a second time, does it connect successfully and send the command to Event Ghost?
>>
If tap the button immediately a second time the power off event (command) is not sent. If I tap it after about 1 minute, the event is sent. No connection error is displayed. I d'ont use the [notimeout] option.

<<
does closing the activity and re-opening then allow it to re-establish the connection?
>>
Yes

<<
do you have to kill TC and restart it to get it to reconnect
>>
No.

<<
or what do you have to do from there
>>
I have closed and reopened the activity.

I hope that helps.....

User avatar
Dave
Site Admin
Posts: 79
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: TC app does not reconnect to the server.

Post by Dave » Fri Feb 17, 2017 5:02 pm

Yes this helps. Sorry I also did not realize there was also an AHK button involved in the WOL. I thought you were using the WOL[xxx] feature of TC to send the WOL using an EventTrigger button. Can you tell me how the AHK button is involved, or what it's script is? Also, have you tried just using an EventTrigger button with the WOL[xxx] command to perform the wake on lan, without AHK being involved, and if so, does that work? And sorry not familiar with "S3", can you tell me what that means? I will try to recreate this exact scenario. I may need you to export your activity and send to me so that I can see and test with exactly what you have. It is odd that TC is not attempting to reconnect when you tap the AHK button after the PC has been awoken the 2nd time. I'll keep you posted on what I find, but if you would like to send your exported activity, you can send to support@touchapptech.com. Thanks.

fxwegr
Posts: 16
Joined: Wed Dec 14, 2016 3:40 pm

Re: TC app does not reconnect to the server.

Post by fxwegr » Sat Feb 18, 2017 12:39 pm

I've tried sending a mail to support@touchapptech.com and received this answer:

'support@touchapptech.com' am 18.02.2017 13:02
550 Blacklisted file type in attachment archive detected

Post Reply