How can I do this?

Hi guys. I want to write a script so that I can basically ping, or just send some sort of signal to my friend's computer, so that it will play an awful scream sound.

It is Mac OS X, so it is Unix based, which is good, because I know a minimal amount of bash scripting. I have access to his computer (he leaves it logged in all the time) and the computer I'm sitting at (that I'll send the message from) is on the same network and such.

I know the basic ideas, I think:
-Have the script running on his computer in the background all the time, also make it run on startup
-When it receives some sort of message, make it turn up the volume, and have it play a short .wav from that computer's HD, also in the background

The hardest part for me is that I don't have any idea how to make it receive a signal. Does anyone have any suggestions or material I could read?

Thanks!!

Also note: Even though I'm a root on my machine and I can do stuff while he's logged in, I don't have an account on his machine, so I don't think I can SSH in.
Last edited on
There may be a better way, but the first that occurs to me is to have a background program listening on some port that you connect to and send some sort of data to. When it gets said data, it plays the sound then continues listening. For something like that you'd want to look into sockets.

Oh yeah, and...this doesn't sound like a very nice thing to do.
Hmm, ok, I'll look into that.

And it's ok, he's not a nice person. Nah, we do stupid stuff like this to each other all the time anyway.
I know this is irrelevant, but just want to say it sounds fun, although wicked ... I can already see your friend being pissed off.
Zhuge's idea is right. But it's going to take you some time to finish this. There're a few nasty details in network programming that are really hard to discuss before you run into the problems. (I've just realized if I come here often enough and implement all the weird but interesting things people want to do, I'll be an expert in programming)
Hahah.

Well, so far I have looked at something called netcat (man nc) that might be exactly what I want. It seems like it would be able to trigger a script.
Topic archived. No new replies allowed.