Tuicemen.com

Advanced search  

News:

Share your Automated House and Ideas in the Members Section! :0~

Pages: [1]

Author Topic: X10Relayer problems  (Read 3534 times)

ArunGupta

  • Jr. Member
  • *
  • Helpful Rating: 0
  • Offline Offline
  • Posts: 6
X10Relayer problems
« on: October 26, 2013, 11:40:57 am »

I have installed X10Relayer on a Windows 7 Professional (64-bit) desktop. The sole purpose of the desktop is to run X10Relayer, connect CM15 and run AHP, there is not any other software running on this desktop. To save power, I put the desktop into hibernation. After waking from hibernation after say 10-15 hours, I found that X10Relayer generally used to crash. So, I created a Windows task which runs on wake from hibernate. The task run a batch file which kill any X10Relayer process and starts a new one. I can see that the X10Relayer starts up fresh. However, the X10Relayer now stops listening on the port 2100 that I have configured. I captured UDP packets on port 2100 using Wireshark and they show that network interface is receiving command from TAC but X10Relayer fails to respond. Even if I manually restarts X10Relayer, it just fails to respond.

If I reboot the desktop and run X10Relayer, it works just fine.

The same thing happens if I connect to my work VPN from the desktop. After disconnecting from VPN (no hibernation of desktop), X10Relayer simply refuses to respond to packets from TAC. Again, Wireshark shows that packets are being received but X10Relayer fails to respond. Restarting X10Relayer has no effect. I have to reboot the desktop to regain functionality.

How to fix these issues?

Thanks,
Arun
Logged

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #1 on: October 26, 2013, 01:02:56 pm »

It sounds like the port isn't getting closed when you force close X10relayer.
Generally only one port can be used by each program and  x10Relayer can't use the port if it is already open.
Try another port maybe one less apt to being used by another program, eg. 9099
I'll be back to the city Tuesday and have access to Win7 to run some tests.
I'll see if there is something I can add to X10relayer to force close a port before it attempts to use it. 
However this would cause issues if the port is in use by other programs.
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #2 on: October 27, 2013, 04:47:05 am »

I ran some tests this morning on my laptop (win 8).
Normaly I don't run just X10relayer but PCC as well.
There does seem to be a issue with restarting and open ports.
I'll know more once I can dig into the code.
If I close x10relayer and PCC then restart PCC,(PCC auto starts X10relayer when configured) x10Relayer starts and works fine.
You might wish to download PCC and give it a try for now.
Since AHP seems to be running fine for you, (your one of the lucky ones) you can still use it as well. ;>
« Last Edit: October 27, 2013, 04:49:10 am by Tuicemen »
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #3 on: October 30, 2013, 10:42:52 am »

Did a little more digging it looks like the issue is windows sees the port open.
If X10relayer is idol another program can grab the port.

ArunGupta: When you use VPN is it using the same port as X10relayer?


You can also use the tool here to find a free port
http://www.mysql-apache-php.com/ports.htm

Since I run PCC from the same PC as X10relayer shutting down X10relayer and restarting it will result in a failed reconnection as windows sees the port open with PCC.
Users running PCC and X10relayer on the same machine need to shut down PCC as well as X10relayer in order for X10relayer to work correctly on restarting.
Since x10relayer is the server restarting PCC has no affect if X10relayer is left running.

Looking into this issue has brought to light a issue with PCC cause from a x10relayer restarting and  PCC requesting a 0 id

Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

ArunGupta

  • Jr. Member
  • *
  • Helpful Rating: 0
  • Offline Offline
  • Posts: 6
Re: X10Relayer problems
« Reply #4 on: November 04, 2013, 04:32:14 pm »

VPN does not use port 2100. I also tested by changing port to 3000 but no luck. I cannot find any difference in networking before connecting to VPN and after disconnecting from VPN. However, X10Relayer just refuses to read the network packets after disconnecting from VPN. The only way to make it work is reboot the PC.

I also noticed that if I launch X10Relayer after connecting to VPN, it displays the "This Computer's IP is" as the IP address assigned to the VPN virtual network interface. Since this address is not on my local network, X10Relayer will obviously not work. However, once I disconnect from VPN and re-launch X10Relayer, the IP address shown is correct but X10Relayer refuses to see the network information.

The netstat -a -b command reveals no change before connecting to VPN and after disconnecting from VPN:

  TCP    127.0.0.1:49169        Win7-Misc:0            LISTENING
 [X10Relayer.exe]

  UDP    0.0.0.0:3000           *:*
 [X10Relayer.exe]

Is there a way to force the program to bind to the physical network adapter only?

Thanks,
Arun
Logged

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #5 on: December 05, 2013, 07:12:20 am »

I've been researching port bindings,opening and closing.
The issue may be in part due to Windows security in newer builds and updates.
As X10relayer evolves it attempts to do things which newer OS may find a security risk.
Closing/opening Ports is one such thing(closing more so), it maybe that X10relayer needs to be run with higher permissions.
I'm Not sure if simply running as admin will resolve these issues.
I'm looking at coding X10relayer to run with elevated accesses. This (in tests) has caused some antivirus scanners to flag it as suspicious.  ::) :`)
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

ArunGupta

  • Jr. Member
  • *
  • Helpful Rating: 0
  • Offline Offline
  • Posts: 6
Re: X10Relayer problems
« Reply #6 on: December 07, 2013, 07:07:53 am »

Thanks for looking into it.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #7 on: December 07, 2013, 11:22:17 am »

Not a Problem.
I'm sure Others will need this info at some point.

Digging deeper into this I found you'll need to setup some firewall rules.
If your just using Windows firewall you can change and create rules by going to Control Panel\System and Security\Windows Firewall
On the left panel click on advanced this will open a screen that allows you to edit and create rules.
exactly what you'll need to set up will depend on your setup.
You may need to do some reading but in my initial searching it does appear windows 7 fire wall should handle port issues.

You may however need to look into another firewall from another vendor.
My favorite was ZoneAlarm (until moving to win 7) it use to have extensive customization and was free.


Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

ArunGupta

  • Jr. Member
  • *
  • Helpful Rating: 0
  • Offline Offline
  • Posts: 6
Re: X10Relayer problems
« Reply #8 on: December 08, 2013, 07:31:09 am »

I am not using any firewall (neither Windows firewall, nor third party firewall) on this desktop so firewall blocking anything is not an issue. Also, the login account is an Administrator account and X10Relayer runs using this account. As I mentioned, I do packet capture on the network interface using Wireshark and I do see packets coming on port 2100 with the correct information but X10Relayer somehow fails to read these packets.

Desktop reboot -> Run X10Relayer -> works fine

Desktop reboot -> Connect to work VPN -> Disconnect from VPN -> Run X10Relayer -> Fails to read incoming packets. Wireshark capture shows packets coming in just fine.

The connection to work VPN does modify the routing tables on the desktop but restores them back after disconnection.

It seems that there is something very deep in the networking layer which is not getting restored properly and is causing X10Relayer to read packets from the VPN network adapter instead of the physical network adapter. The logic behind this reasoning is that when I am connected to work VPN and run X10Relayer, it picks up the IP address assigned to the VPN adapter. This is the reason why I thought that binding X10Relayer to a user selectable physical NIC might get around the problem. It will work even if there are multiple physical/virtual network adapters in the desktop. X10Relayer will listen only on the network adapter that I choose.


Logged

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #9 on: December 08, 2013, 08:49:44 am »

You can bind to either/or/and a port, IP, and NIC using a good firewall.
As you say the issue appears to be in the windows routing tables.
I could try:
Having X10relayer listen to all local adaptors on the specified port
Forcing X10relayer to load on a specific IP instead of the one it sees automatically.
 (Chr)

 
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #10 on: December 08, 2013, 04:06:56 pm »

Ok I've been playing with some code, also windows firewall.
I now have x10relayer not throwing the error about the port being open.
I'm not sure which fixed it ::) :`) (RoFL)
Also I think the reason behind x10relayer crashing is I had it sending hand shakes ever so often.
This caused a memory use build up (memory leak) which became more noticeable with the new PCC.
I sent you a PM with the link to the new test build.
 (Chr)
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

ArunGupta

  • Jr. Member
  • *
  • Helpful Rating: 0
  • Offline Offline
  • Posts: 6
Re: X10Relayer problems
« Reply #11 on: December 14, 2013, 09:44:13 am »

Sorry for delayed reply. I am somehow missed the email.

I tested the new build but still have the same problem. After disconnecting from VPN, when I launch X10Relayer, it just does not listen to incoming packets. I did capture with Wireshark and Windows Network Monitor and both the captures show incoming packets on port 2100 on the Ethernet adapter. For some reason, X10Relayer just isn't able listen to them.

When X10Relayer is working normally, when I launch TAC on Android phone, it sends a message to server and the server responds back. After disconnecting from VPN, the packet capture shows incoming message from TAC but X10Relayer never responds indicating that somehow the incoming message did not reach the server.

Is it possible to build a debug version which writes out the network bindings etc. to a log file? I can surely test it out.

Thanks...
Logged

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #12 on: December 15, 2013, 10:27:43 am »

I'll see if I can put something together.
that displays all detected info.
With restarting x10relayer it starts off as ignoring all signals that don't send the hand shake.
it still see them just ignores them this may be where the issue lies.
Are you restarting TAC as well after x10Relayer restarts?
If I remember rotating the TAC device will resend the hand shake not just restarting.
 (Chr)
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!

ArunGupta

  • Jr. Member
  • *
  • Helpful Rating: 0
  • Offline Offline
  • Posts: 6
Re: X10Relayer problems
« Reply #13 on: December 22, 2013, 07:08:29 am »

Yes, after restarting X10Relayer, I am restarting TAC also. That is when I see the initial "hello" from TAC but X10Relayer just seems to ignore that initial "hello".
Logged

Tuicemen

  • Administrator
  • Hero Member
  • *****
  • Helpful Rating: 24
  • Offline Offline
  • Posts: 3144
  • Making Home Automation Fun!
    • Tuicemen.com
Re: X10Relayer problems
« Reply #14 on: December 23, 2013, 06:57:20 am »

I'm wondering if I may have inadvertently removed some reconnect code. needed in some instances. ??? :`) :-[
I'm looking at a rebuild starting from a older build  as a starting point.
I'll PM you with a test link once I have something put together.
 (Chr)
Logged
Get the inside scoop and member perks in the
Members Only Section!

Please don't email me Automation questions 
The forum is for that!
Pages: [1]