Jump to content

Wikipedia:Reference desk/Archives/Computing/2020 March 17

From Wikipedia, the free encyclopedia
Computing desk
< March 16 << Feb | March | Apr >> March 18 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


March 17

[edit]

On-line Data Table

[edit]

I want a stand-alone program loadable on any PC Windows version that responds to pressing a function key by displaying a table of friends' names and their indoor home temperatures, periodically updated. I identify the following tasks for the program:

  • Listens to a predefined Internet address and port for messages
  • Sends a RequestData message to the shared address
  • On receiving the RequestData message
  • First time: does nothing but counts the number of responses from other PCs. There can be up to 31 responses that are sent nominally one per second. If N<30 responses are heard then our program decides to use slot# (N+1) in future. If slot# 31 was occupied, our program may decide to use an earlier slot that has been vacated, otherwise the network is full and our program can display but not send.
  • Subsequent times: displays a list of received Names and Temperatures. Sends own name and temperature (found at a known address in PC memory) in the previously chosen timeslot.
  • The program using slot #1 is expected to drive the network by generating a Request Data message every 60 seconds.
  • All programs monitor the rate of RequestData messages. If RequestData is absent for 90 seconds, the program waits a random period 30-to-60 seconds and then takes over slot #1 by sending a RequestData message to which the network responds.
______________________________
Name            |  Indoor temp
------------------------------
George Adams    |    25°C
John Jefferson  |    22°C
Thomas Madison  |    27°C
DroneB          |    19°C
______________________________

This is a simple program with no claims of speed, security or error tolerance. Your advice is needed on a programming language for the Internet messaging interface. DroneB (talk) 17:41, 17 March 2020 (UTC)[reply]

Any Microsoft Windows version, all the way back to Windows 1.0, or do you really mean "currently-supported versions"? Assuming you mean the latter, the main issue is: can you install (or have installed) stuff as-needed on target systems? If the program has to be a standalone executable with no dependencies, then you'll generally need to use C or C++. Otherwise I'd suggest Python. The issue is you need to install the Python interpreter for a Python program, and possibly libraries. This is generally the case for any language/toolchain that doesn't facilitate building a statically linked executable. --47.146.63.87 (talk) 19:04, 17 March 2020 (UTC)[reply]
OP here. Ideally the program will be a stand-alone executable that I can mail to friends who have home PCs that may run older Windows versions such as XP or Vista. I think I can compile the algorithm in C or BASIC but I have zero experience of message interfacing to the Internet. For that I need help. DroneB (talk) 00:29, 18 March 2020 (UTC)[reply]
Wow, I think my head just exploded when you said you're going to email an executable that runs a public Internet server on EOL'd operating system platforms. Elizium23 (talk) 07:47, 18 March 2020 (UTC)[reply]
Okay, sounds like there's no issue there. There are tools for platforms like Python to wrap everything up in a single installer package. But I want to make sure we don't have an XY problem here. Where are these temperatures coming from? Something like a networked thermostat? If so, those can usually report the temperatures to some Internet service. Also there's a problem you're likely to run into: network address translation (NAT). It sounds like you envision this to be a peer-to-peer thing where any copy of the program can "take over" gathering temperature data. Unfortunately, for this to work, if any of your friends have a NAT between them and the Internet (like on their Internet gateway/router), they'll have to configure port forwarding to allow their copy of the program to receive messages from the Internet when it "takes over". Also there are potential headaches with dynamic IP addresses. The easier solution is to use a server-client architecture where you host a server on the Internet and have all the programs connect to the server. And yeah, as Elizium23 said, if your friends are using old, unsupported Windows versions like Vista, you should nudge them to upgrade, as this makes them vulnerable to malware. --47.146.63.87 (talk) 08:11, 18 March 2020 (UTC)[reply]
OP again. For the purpose of my question, temperature values may come from digital thermometers connected to the PCs. (Other applications for low data rate monitoring abound such as house intrusion sensors and fire alarms.) Yes, decentralized peer-to-peer networking is envisioned so that any PC can connect on line at any time and all PCs will display the available data. May my program send and intercept Ping message packets? It might A) pass data in the payloads of the Pings, or B) crudely signal by multiple Pings in Morse code. Thoughts on security are that the program that I distribute contains only my own IP address. Each remote machine has first to handshake with my machine to declare its IP address before it can access our network. DroneB (talk) 12:39, 18 March 2020 (UTC)[reply]
DroneB, peer-to-peer networking is complicated because of issues with NAT traversal, home firewalls, etc. You are *much* better off having a central web server collecting and dishing out the temperature data from the PC's. Cheap web hosting would be fine for the purpose and is probably the simplest approach. I'm happy with buyshared.net which starts at $8/year and has good support. Then there is issue of writing the software. It's not complicated but it might be a bit much for someone with no programming experience. 2601:648:8202:96B0:386A:A40C:EBB1:ACC0 (talk) 23:35, 18 March 2020 (UTC) (Added because I hadn't fully read 47.146.63.87's post:) running any kind of port listener on a PC is complicated. You really want the PC program to only originate outgoing connections, not respond to incoming ones. A program that responds to incoming connections is called a server, and "peer-to-peer" basically means the program is both a client and a server. Running a client on a PC is fine but it's a lot easier for your server to actually be a server. If you really have to do everything on PC's, you probably want to designate one or two of them as "masters" with static IP addresses, basically acting as servers. 2601:648:8202:96B0:386A:A40C:EBB1:ACC0 (talk) 02:11, 19 March 2020 (UTC)[reply]
Another issue is that your ISP and your friends' ISPs may prohibit "running a server" in their Terms of Service. So while they may technically make it difficult for you to accept inbound TCP/UDP, even if you do find a way, you may be violating your Terms and subject to disconnection if the ISP is so inclined. Elizium23 (talk) 02:14, 19 March 2020 (UTC)[reply]

Is this a homework assignment, or alternatively, why is that particular architecture required? See XY problem. If you want a way to upload and monitor those temperatures the most convenient way is probably to set up a web site for the purpose. The standalone program would be either a browser or an http client. Then use some cheap or free web hosting to run (e.g.) a PHP script that stores the temperatures in a database table. The clients upload and retrieve the temperatures from the script. 2601:648:8202:96B0:386A:A40C:EBB1:ACC0 (talk) 21:20, 18 March 2020 (UTC)[reply]

I don't know if this is hitting a fly with a sledgehammer, but Weather Underground has a network of personal weather stations and so the design and implementation of something like this is a solved problem. Of course, the PWS usually contains many more instruments than a thermometer, and this is a very large, cloud-based public network. But installing a PWS is more or less as easy as putting together a Raspberry Pi. Elizium23 (talk) 23:53, 18 March 2020 (UTC)[reply]
A cloud-based weather service? How else? :-) Martin of Sheffield (talk) 09:13, 19 March 2020 (UTC)[reply]
Thanks, that nearly made me snort my coffee :-P Rmvandijk (talk) 08:59, 20 March 2020 (UTC)[reply]