|P is for Practical
Re: Does Perl ring a bell?by schweini (Friar)
|on Sep 09, 2005 at 22:36 UTC
I did something similar once, and it was surprisingly easy, even if i guess it wasn't the most elegant solution around:
i simply soldered a relais to some pins on my parallel port (tons of guides online for soing stuff like that), since you can control quite a couple of those pins by sending bitmasks to the port. then i stole some C code for doing tha appropiate syscall (ioctl, IIRC) from some website, and made a perl CGI script call that C program when it got hit. On the remote server, i simply used LWP to call the CGI script that was on my home machine when it tried to ring that bell, and it worked great.
You could of course use SOAP or whatever for the communication between the two locations, but plain HTTP worked just fine for me.
you could also buy really cheap usb->parallel port adaptors so that you don't fry your 'real' port if you mess up - but i wouldn't know how to address USB ports with C...