I want one of machine have a remote control alarm running that can be triggered by any remote machine. More preciselyMachine A is running the service in the backgroundAny remote machine B can send a packet to machine A to trigger the alarm (a command called alarm)How would you suggest do do it?I would use nc:Service on machine A:nc -l 1111; alarmMachine B triggers the alarm withnc <IP of machine A> 1111I can also write some python to open a socket...
Remote control alarm
networking;socket;packet;unix sockets;nc
Consider this Python3 example.Server A:#!/usr/bin/env python3# coding=utf8from subprocess import check_callfrom xmlrpc.server import SimpleXMLRPCServerfrom xmlrpc.server import SimpleXMLRPCRequestHandler# Restrict to a particular pathclass RequestHandler(SimpleXMLRPCRequestHandler):    rpc_paths = ('/JRK75WAS5GMOHA9WV8GA48CJ3SG7CHXL',)# Create serverserver = SimpleXMLRPCServer(    ('127.0.0.1', 8888),    requestHandler=RequestHandler)# Register your functionserver.register_function(check_call, 'call')# Run the server's main loopserver.serve_forever()Server B:#!/usr/bin/env python3# coding=utf8import xmlrpc.clienthost = '127.0.0.1'port = 8888path = 'JRK75WAS5GMOHA9WV8GA48CJ3SG7CHXL'# Create clients = xmlrpc.client.ServerProxy('http://{}:{}/{}'.format(host, port, path))# Call your function on the remote servers.call(['alarm'])