I need to write an app on Mac OS X that would send remote command to Windows applications to perform some tasks. The compute开发者_JS百科rs will be sitting on the same subnet and the Mac and Windows computers all have a fixed IP.
The data sent over really are just some string or boolean parameters so that the Windows app can perform specific tasks.
Someone will be writing the Windows app and I will be writing the Mac app.
I can find in the developer's doc about Mac to Mac communication, but nothing about what I need.
What's the best way to achieve this? What protocol is best suited for this?
Take a look at the Bonjour SDk for Mac and Windows: http://developer.apple.com/opensource/
There are (at least) two separate problems here:
- #1 is how you discover the other app. Bonjour is one possibility, as is a local broadcast, as is explicitly configuring the hostname of the peer
- #2 is how you talk to the other machine once you find it. For that part, I would suggest:
- a) use TCP instead of UDP (in most cases), so you don't have to worry about retransmissions & sequencing
- b) rather than inventing your own client-server protocol on top of TCP, use an existing one. I hear there's something called "HTTP" that's starting to catch on...
Could you just use UDP to broadcast a message out to the network? Your apps (regardless of whether they are running on Mac or Windows) can listen for the message and process them as needed.
精彩评论