Trixology

WeatherCat => WeatherCat iOS Clients => iOS Client Help => Topic started by: Xipper on November 20, 2017, 10:20:01 PM

Title: Issues getting WeatherCat client to work over Internet
Post by: Xipper on November 20, 2017, 10:20:01 PM
I am having problems getting WeatherCat clients to work via the Internet (applies to both iOS clients and OS X client).  I have port forwarding setup to send the ports from the public IP on my router to the desktop that WeatherCat runs on.  They work if using "local network", however anytime they are set to use the Internet URL they fail and unfortunately there is zero feedback in any of the clients other than a generic failed to connect error.

If I use nectat (nc) to perform test connections across all of the required TCP ports I get the same response against the NAT as I do directly against the desktop.  This seems to suggest that it should work, however none of the clients actually read the data.

Is there any path of seeing why the client isn't accepting the data?

As an example, if I netcat port 49251 on the public IP and the desktop I get the same data:

nc 192.168.1.5 49251
Quote
5,80,0,0,13.500000,1,76,1,23.611111,1,44,1,9.350598,1,1011.476379,1,0.000000,1,22.098000,1,6.437376,1,287.000000,1,13.500000,1,4.828032,11.265408,311.322937,
W:287,6.437376,6.437376,0.000000,0.080500,0.000000,0.053667,0.000000,0.000000,0.000000,0.000000,0.000000,0.053667,0.000000,0.000000,0.080500,0.107333,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.214667,0.000000,0.134167,0.000000,0.134167,0.000000,0.000000,0.000000,0.000000,0.214667,0.000000,0.000000,0.000000,0.107333,0.080500,0.268333,0.348833,0.348833,0.000000,0.080500,0.107333,0.241500,0.322000,0.456167,0.000000,0.536667,0.536667,0.402500,0.322000,0.322000,0.322000,0.214667,0.187833,0.456167,0.000000,0.000000,0.456000,0.536500,0.429167,1.368167,0.322000,0.509833,1.287667,0.590167,0.912000,0.939000,0.643667,1.475667,0.375667,0.617000,1.207333,1.797500,0.670667,1.234000,1.314000,1.636500,2.549000,1.663167,1.716667,0.992500,1.716500,1.985500,1.019500,2.361166,2.575334,0.778000,2.065834,0.992667,2.199333,1.367833,1.904667,1.475000,1.153500,2.360167,2.145833,2.816333,2.682333,2.038667,3.754666,5.417167,1.957833,2.789166,2.092167,2.520833,2.038000,0.402333,0.670333,0.455833,0.429000,0.992500,0.214500,0.214500,0.187833,0.053667,0.000000,0.536500,0.563167,0.161000,0.134167,0.805000,0.509833,1.100000,0.483000,0.885500,0.295167,0.456167,0.214667,0.161000,0.563500,0.509833,0.348833,1.073333,0.134167,0.000000,0.322000,0.214667,0.053667,0.268333,0.000000,0.187833,0.107333,0.214667,0.053667,0.751333,0.268333,0.134167,0.053667,0.214667,0.214667,0.000000,0.026833,0.053645,0.214667,0.187833,0.000000,0.000000,0.241500,0.107333,0.026833,0.322000,0.053667,0.000000,0.000000,0.053667,0.000000,0.322000,0.322000,0.456167,0.214667,0.187833,0.187833,0.268333,0.161000,0.241500,0.187833,0.134167,0.214667,0.107333,0.456167,0.107333,0.187833,0.080500,0.134167,0.107290,0.080500,0.026833,0.241500,0.161000,0.107333,0.322000,0.107333,0.107333,0.107333,0.053667,0.053667,0.053667,0.053667,0.161000,0.134167,0.107333,0.026833,0.000000,0.187833,0.000000,0.161000,0.187833,0.053667,0.134167,0.053667,0.026833,0.080500,0.053667,0.134167,0.080500,0.000000,0.053667,0.107333,0.000000,0.134167,0.053667,0.241500,0.348833,0.134167,0.053667,0.268333,0.322000,0.134167,0.026833,0.000000,0.000000,9.280000,14.720000,7.390000,12.280000,7.910000,14.720000,9.279999,14.720001,360.000000,2000.000000,72.000000,94.000000,999.996582,1011.611877,0.000000,17.700001,0.000000,29.719999,0.000000,22.100000,0.000000,37.009998,20.000000,23.722221,43.000000,47.000000,0.000000,0.000000,0.000000,0.000000,3.521790,110.148972,Cloudy

nc <public address> 49251
Quote
5,85,0,0,13.500000,1,76,1,23.611111,1,44,1,9.350598,1,1011.476379,1,0.000000,1,22.098000,1,9.656064,1,284.000000,1,13.500000,1,4.828032,11.265408,310.149200,
W:284,9.656064,9.656064,0.000000,0.080500,0.000000,0.053667,0.000000,0.000000,0.000000,0.000000,0.000000,0.053667,0.000000,0.000000,0.080500,0.107333,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.214667,0.000000,0.134167,0.000000,0.134167,0.000000,0.000000,0.000000,0.000000,0.214667,0.000000,0.000000,0.000000,0.107333,0.080500,0.268333,0.348833,0.348833,0.000000,0.080500,0.107333,0.241500,0.322000,0.456167,0.000000,0.536667,0.536667,0.402500,0.322000,0.322000,0.322000,0.214667,0.187833,0.456167,0.000000,0.000000,0.456000,0.536500,0.429167,1.368167,0.322000,0.509833,1.207167,0.590167,0.912000,0.939000,0.643667,1.475667,0.375667,0.617000,1.207333,1.797500,0.670667,1.234000,1.314000,1.636500,2.549000,1.663167,1.716667,0.992500,1.716500,1.985500,1.019500,2.361166,2.575334,0.778000,2.065834,0.992667,2.199333,1.367833,1.904667,1.475000,1.153500,2.360167,2.145833,2.816333,2.682333,2.038667,3.754666,5.417167,1.957833,2.789166,2.092167,2.520833,2.038000,0.402333,0.670333,0.455833,0.429000,0.992500,0.214500,0.214500,0.187833,0.053667,0.000000,0.536500,0.563167,0.161000,0.134167,0.805000,0.509833,1.100000,0.483000,0.885500,0.295167,0.456167,0.214667,0.161000,0.563500,0.509833,0.348833,1.073333,0.134167,0.000000,0.322000,0.214667,0.053667,0.268333,0.000000,0.187833,0.107333,0.214667,0.053667,0.751333,0.268333,0.134167,0.053667,0.214667,0.214667,0.000000,0.026833,0.053645,0.214667,0.187833,0.000000,0.000000,0.241500,0.107333,0.026833,0.322000,0.053667,0.000000,0.000000,0.053667,0.000000,0.322000,0.322000,0.456167,0.214667,0.187833,0.187833,0.268333,0.161000,0.241500,0.187833,0.134167,0.214667,0.107333,0.456167,0.107333,0.187833,0.160967,0.134167,0.107290,0.080500,0.026833,0.241500,0.161000,0.107333,0.322000,0.107333,0.107333,0.107333,0.053667,0.053667,0.053667,0.053667,0.161000,0.134167,0.107333,0.026833,0.000000,0.187833,0.000000,0.161000,0.187833,0.053667,0.134167,0.053667,0.026833,0.080500,0.053667,0.134167,0.080500,0.000000,0.053667,0.107333,0.000000,0.134167,0.053667,0.241500,0.348833,0.134167,0.053667,0.268333,0.322000,0.134167,0.026833,0.000000,0.000000,9.280000,14.720000,7.390000,12.280000,7.910000,14.720000,9.279999,14.720001,360.000000,2000.000000,72.000000,94.000000,999.996582,1011.611877,0.000000,17.700001,0.000000,29.719999,0.000000,22.100000,0.000000,37.009998,20.000000,23.722221,43.000000,47.000000,0.000000,0.000000,0.000000,0.000000,3.487854,110.228966,Cloudy

I can provide the URL via private message for debug if that helps, just don't want to share it in any Google index sites.
Title: Re: Issues getting WeatherCat client to work over Internet
Post by: Xipper on November 20, 2017, 10:22:50 PM
On OSX WeatherCat Client i finally found some logs:

Quote
Nov 20 14:21:07 TheBadApple WeatherCatClient[77507]: Looking-up WeatherCat Server...
Nov 20 14:21:07 TheBadApple WeatherCatClient[77507]: Found the machine - getting details...
Nov 20 14:21:07 TheBadApple WeatherCatClient[77507]: Server details: x.x.x.x on port 49250
Nov 20 14:21:29 TheBadApple WeatherCatClient[77507]: ***Packet timed out. Socket 64***
Nov 20 14:21:29 TheBadApple WeatherCatClient[77507]: Server is not responding. Retrying...

Title: Check Wiki? (Re: Issues getting WeatherCat client to work over Internet)
Post by: elagache on November 20, 2017, 11:18:12 PM
Dear Xipper and WeatherCat network troubleshooters,

I am having problems getting WeatherCat clients to work via the Internet (applies to both iOS clients and OS X client). 

Unfortunately I have never tried to setup Internet access so I can't help you.  You appear to have provided all the necessary connections, so I hope someone else will spot something.  In the meantime, you might look over the troubleshooting tips on the WeatherCat Wiki:

http://wiki.trixology.com/index.php?title=WeatherCat_Clients (http://wiki.trixology.com/index.php?title=WeatherCat_Clients)

Perhaps something there will help you out.

Cheers, Edouard
Title: Re: Check Wiki? (Re: Issues getting WeatherCat client to work over Internet)
Post by: Xipper on November 21, 2017, 12:59:32 AM
Dear Xipper and WeatherCat network troubleshooters,

Unfortunately I have never tried to setup Internet access so I can't help you.  You appear to have provided all the necessary connections, so I hope someone else will spot something.  In the meantime, you might look over the troubleshooting tips on the WeatherCat Wiki:

http://wiki.trixology.com/index.php?title=WeatherCat_Clients (http://wiki.trixology.com/index.php?title=WeatherCat_Clients)

Perhaps something there will help you out.

Cheers, Edouard

Thanks for the reference to the troubleshooting guide, at first I thought I had solved it.  The documentation refers to configuring both TCP and UDP, my configuration lacked UDP as I have to write duplicate rules for everything to support it and just never did (though it did as-is previously).  I added the UDP rules and one of the iOS clients worked...but then it stopped. 

It seems that while the instructions imply that WeatherCat Server is listening on 5 ports on both UDP and TCP (49250-49254), it is in fact not actively doing so.  In fact the service isn't listening on UDP at all..so the additional UDP rules are probably of zero value, but I'll leave them to save having to add them back if I am proven wrong.  However according to the OS X IP stack:
Quote
lsof -n -i4TCP | grep Weather
WeatherCa 78214 username   11u  IPv4 0x4593ab83e15788c5      0t0  TCP *:49252 (LISTEN)
WeatherCa 78214 username   82u  IPv4 0x4593ab83e15788c5      0t0  TCP *:49252 (LISTEN)

The additional detail here is that, apparently on service startup WeatherCat Server actually only binds to one of the possible 5 TCP ports...and it seems that on restart it may pick a different one.  I am guessing that the clients then have to try to connect to all 5 ports trying to find which one the server is actually listening on, and depending on how a given firewall implements these port forwarding it may take a long time for the "invalid" ports to timeout.

There has got to be a better way to do this, in my case it takes 2+ minutes for WeatherCat client to find the correct TCP port out of the 5 to use.  This would even be worse if it was using 49254 as it would take that much longer for the client to walk the TCP ports. 

What I don't understand is why it need so pick from a range of 5 TCP ports, rather than just using 49250 every time.  Once the client does detect what TCP port is active it caches that detail and at least allows easy refreshing (for some period of time)...but having it take 2 minutes, or possibly 4 or 5 minutes, the "first time" seems rather costly in terms of mobile app experience.
Title: Re: Issues getting WeatherCat client to work over Internet
Post by: The Grand Poohbah on November 21, 2017, 05:56:56 PM
Quote
What I don't understand is why it need so pick from a range of 5 TCP ports, rather than just using 49250 every time.  Once the client does detect what TCP port is active it caches that detail and at least allows easy refreshing (for some period of time)...but having it take 2 minutes, or possibly 4 or 5 minutes, the "first time" seems rather costly in terms of mobile app experience.

What you are experiencing is definitely not the usual behavior. The client may take a few extra seconds the first time it connects, but after that, the connection should be fairly quick. Send me your URL and I'll try to connect from here.
Title: Re: Issues getting WeatherCat client to work over Internet
Post by: Xipper on November 21, 2017, 06:40:01 PM
What you are experiencing is definitely not the usual behavior. The client may take a few extra seconds the first time it connects, but after that, the connection should be fairly quick. Send me your URL and I'll try to connect from here.

I private messaged my URL, I also have a screen shot I can send of the firewall logs showing that the client takes a while.  In today's testing it started the connection to 49250 at 10:22:23, it opened 11 TCP sessions to TCP:49250 before proceeding to the next port.  At 10:23:38 it started the same process on TCP:49251.  It then did the same for TCP:49252 at 10:25:01, where it found the server and started functioning. So in this test it only took 2 minutes and 38 seconds to find it.
Title: Re: Issues getting WeatherCat client to work over Internet
Post by: Blicj11 on December 07, 2017, 04:03:13 PM
Xipper:

Did you get this resolved?