[web2py] Re: Background M2M communication

2013-02-07 Thread Massimo Di Pierro
Good point. yes you should close it but how and why depends on your protocol and how you use the function. On Wednesday, 6 February 2013 20:19:31 UTC-6, Bernard wrote: > > Thanks, it works. > Do I have to worry about s.close()? > > On Wednesday, February 6, 2013 6:12:06 PM UTC-8, Massimo Di Pierr

[web2py] Re: Background M2M communication

2013-02-06 Thread Bernard
Thanks, it works. Do I have to worry about s.close()? On Wednesday, February 6, 2013 6:12:06 PM UTC-8, Massimo Di Pierro wrote: > > yes: > > def connect(address): > socket.settimeout(10) > s = socket.socket() > return s.connect(address) > > mysocket = cache.ram('socket',lambda address=

[web2py] Re: Background M2M communication

2013-02-06 Thread Massimo Di Pierro
yes: def connect(address): socket.settimeout(10) s = socket.socket() return s.connect(address) mysocket = cache.ram('socket',lambda address=(ip,port): connect(address),3600) mysocket.send('hello world') But mind that s.connect may block. On Wednesday, 6 February 2013 19:32:49 UTC-6

[web2py] Re: Background M2M communication

2013-02-06 Thread Bernard
Is it possible to use cache.ram for a TCP socket? In my setup, establishing a TCP connection to a remote machine is time consuming and I need to find a workaround to have snappier response to the Web UI. Any help appreciated. Thanks, Bernard On Monday, February 4, 2013 11:46:22 AM UTC-8, Berna

[web2py] Re: Background M2M communication

2013-02-04 Thread Bernard
Thanks Derek, There is a second requirement that is not realtime based, but I omitted that because the challenges are not as tricky. The workstation has a database to manage historical data and keep configuration information for the field units (GPS location, IP address etc.), but also has to

[web2py] Re: Background M2M communication

2013-02-04 Thread Derek
Well, depends on the MFUs I guess. I would probably bypass web2py for this and simply use a javascript based polling reader based on websockets. Of course, you'd have to have a websockets enabler on all the MFUs Is there any reason why you'd use a database for this? If all you are looking for is