Re: Time-outs in LC Server?

2019-07-18 Thread Alex Tweedly via use-livecode

You should never use 'send in time' or 'wait with messages' in LCServer.

Each http request starts up your LC server script anew - and you need 
that request to be handled and the server-instance shut down as quickly 
as possible. And the next http request will start up another, entirely 
separate, instance; so you need to be storing some status info between 
requests.


If a user doesn't do anything on the site for a few minutes, then you 
can use a flow something (vaguely) like :


(at start of the script):

 - check if user is logged in (if not, prompt them to login / register 
/ ...)


 - check a database entry for when they were last active (up to you 
whether that's per-user, per user/per-IP address, or per-some-cookie, or 
...)


 - if time-since-last-action is too long - log them out, and as 
appropriate, either

  a.  apologise :-), and go to login screen
  b. return a "not logged in" error

 - if it is still within time, then update the "last active" database entry

 - then do the rest of the current request


Alex.

On 18/07/2019 17:45, Rick Harrison via use-livecode wrote:

I  was playing around with Send In Time
with LC Server.  It’s throwing an error
at me after it’s supposed to be all done
executing.

The reason I was playing with such things
is I want to be able to logoff any user that
hasn’t been using the website for a few
minutes when the system times out.

How are you handling such things in
LC Server?

I did come across a Javascript that
might work, but I’d rather use LC
for the task if possible.

Suggestions?

Thanks in advance!

Rick
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Time-outs in LC Server?

2019-07-18 Thread Rick Harrison via use-livecode
I  was playing around with Send In Time
with LC Server.  It’s throwing an error
at me after it’s supposed to be all done
executing.  

The reason I was playing with such things
is I want to be able to logoff any user that
hasn’t been using the website for a few
minutes when the system times out.

How are you handling such things in 
LC Server?

I did come across a Javascript that
might work, but I’d rather use LC
for the task if possible.

Suggestions?

Thanks in advance!

Rick
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: source of a socket error message

2019-07-18 Thread Mark Wieder via use-livecode

On 7/18/19 8:11 AM, dsc--- via use-livecode wrote:

Also...

If you have control of these sites and even if you use an ISP DNS service, you 
can add a secondary DNS IP address, perhaps a public recursive name server such 
as the Google Public DNS (8.8.8.8).  This will add a robustness without 
upgrading the software.

If you don't manage those, you can you can upgrade the software to access a 
public name server directly with TLS, or use DNS over HTTPS. DNS over HTTPS is 
not as easy as it sounds, but should be doable. It is available without 
filtering from Google, Quad9 (use 9.9.9.10 for no filtering), or (if you don't 
use Cisco) Cloudflare 1.1.1.1.


DoH is getting easier to use all the time but still hasn't reached a 
level of plug-and-play availability. I set up a Raspberry pi on our LAN 
running a DoH service that hooks into Cloudflare on the backend and it's 
transparent and painless (if I'm allowed to mix metaphors).


Normally I'd agree with you on this, but what has me worried about the 
problem situation is "occasionally I get a "mass" of errors (50 or 60) 
within a 1 hour period of time from a large variety of different 
external sites". So it's not a DNS outage from a single location,


That said, last week I had a maddeningly similar thing occur here... I 
suddenly couldn't resolve addresses, and worse, couldn't even ping 
numeric addresses outside our ISP's gateway. After working with our 
ISP's tech support, rebooting our router got us a new IP address in the 
router's routing table and that fixed the problem. Possibly some problem 
with fiber DHCP refreshing, and I hesitate to suggest that something 
similar is at work here, but strange things happen.




You might want to add some network diagnostics, where you can log or otherwise 
report the results. This will help solidify your analysis.

If you have control over the server and know the IP address will never change, 
you can skip the name lookup and just use the IP address.


That or your excellent suggestion of cacheing the address once it's 
originally resolved.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: source of a socket error message

2019-07-18 Thread Bob Sneidar via use-livecode
Not to put too fine a point on it but that gives me the heebie jeebies. There 
are ~5000 instances of the app. The dev can't control what the ISP of the 
server does, or if the hosting company goes out of business or gets bought out. 
Although rare, an ISP CAN alter the public IP subnet. It happened to me twice, 
a long time ago admittedly. Once for my homw ISP and one for a business ISP. 

Using IP addresses is like using pointers in app development. 

Bob S


> On Jul 18, 2019, at 08:11 , dsc--- via use-livecode 
>  wrote:
> 
> If you have control over the server and know the IP address will never 
> change, you can skip the name lookup and just use the IP address. 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: source of a socket error message

2019-07-18 Thread dsc--- via use-livecode
Also...

If you have control of these sites and even if you use an ISP DNS service, you 
can add a secondary DNS IP address, perhaps a public recursive name server such 
as the Google Public DNS (8.8.8.8).  This will add a robustness without 
upgrading the software.

If you don't manage those, you can you can upgrade the software to access a 
public name server directly with TLS, or use DNS over HTTPS. DNS over HTTPS is 
not as easy as it sounds, but should be doable. It is available without 
filtering from Google, Quad9 (use 9.9.9.10 for no filtering), or (if you don't 
use Cisco) Cloudflare 1.1.1.1.

You might want to add some network diagnostics, where you can log or otherwise 
report the results. This will help solidify your analysis.

If you have control over the server and know the IP address will never change, 
you can skip the name lookup and just use the IP address. 

> On Jul 17, 2019, at 7:51 PM, Dar Scott via use-livecode 
>  wrote:
> 
> This is very likely a loss of network availability and of that a loss of 
> Internet availability.
> 
> The library will first look up the URI to get an IP address. The IP address 
> is used to make a connection to the server.  The computer has (or can get) an 
> IP address to use for making that look up.  Since that this the first 
> operation, a loss of Internet will show up with that error.
> 
> If you are sure there is access to the Internet, then it might be that the 
> DNS server is down. That seems unlikely, but possible. If the server IP is 
> fixed, then use a cached version of the IP. Use hostNameToAddress() to get 
> the IP address, save that on success, use the saved address on failure.
> 
> 
>> On Jul 17, 2019, at 6:27 PM, Douglas Ruisaard via use-livecode 
>>  wrote:
>> 
>> Let me start this off by stating that the information I am seeking IS NOT 
>> due to an *issue* with LC.  Hopefully, I can make it clear why I am asking 
>> for assistance from this group in regard to the situation I am trying to 
>> deal with and why I need the LC expertise of this group as a resource.
>> 
>> In a portion of a large application, which has been distributed to a large 
>> number (5,000+) of remote/external sites, I have a call to a TCP socket:
>> 
>> on OpenCard 
>> ...
>>put ftp_server & ":" & tcp_port into temp1
>>open socket to temp1 with message "NewConnection"
>>wait for messages  
>> end OpenCard
>> 
>> Then there are a variety of "call-backs" based on when happens after I open 
>> the socket.  One of these call-backs is "socketError":
>> 
>> on socketError theID, theError
>>close socket theID
>>do_log " " & sftp_account && "file: " & "There is a problem with the TCP 
>> connection: " & theError, "connect", 3
>>  ...
>> end socketError
>> 
>> This works PERFECTLY 99.999% of the time.  However, occasionally I get a 
>> "mass" of errors (50 or 60) within a 1 hour period of time from a large 
>> variety of different external sites (I get all of the remote site's logs) 
>> ... i.e. many different sites connecting in from many different locations 
>> around the province of Ontario ... a very large place!
>> 
>> The error returned is: "can't resolve hostname"... returned in the 
>> "theError" parameter of the socketError function.
>> 
>> Here's where I need help.  I need to find out, with as great a level of 
>> detail as possible, EXACTLY what (from LC's "point-of-view") triggers this 
>> error, what part(s) of the LC engine are involved with generating this error 
>> and if there is more than the obvious cause of the remote site's DNS server 
>> (via their ISP or internal server(s)) not being able to "see" the hostname 
>> that could produce this error.
>> 
>> Although this "error" appears to be "common" from a variety of sources (none 
>> of which are written in LC, as far as I can tell)... I cannot find any 
>> "standard" by  which a DNS generates this specific message.  NSLOOKUP would 
>> be the closest candidate but even it doesn't produce this specific error of 
>> being "unable to resolve the hostname"... so that leaves LC with the 
>> responsibility of the content of the error.
>> 
>> I REALLY want to emphasize that, as far as I am concerned, this is not a 
>> problem with LC, in any manner... but I need to find out where and why LC 
>> generates this message.
>> 
>> I am not sure what or where to search for this error or what generates it 
>> from with the LC components but if someone could help me "find" a starting 
>> point, I should be able to reverse-engineer the logic.
>> 
>> The overall situation is fairly complex but I'd be very open to providing 
>> more details if anyone feels it is warranted.
>> 
>> Whatever help could be provided will be very, very appreciated!
>> 
>> Douglas Ruisaard
>> Trilogy Software
>> (250) 573-3935
>> 
>> 
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your