Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

KylieM

macrumors newbie
Original poster
Dec 20, 2014
3
0
Hi everyone

I am an experienced Windows developer but new to mac development and specially network programming.

I have an idea in my mind for a program that needs to somehow make a communication possible between a Mac machine and a Windows machine.

In particular I want to develop two applications:

1- Application called "M": An app written in XCode that run on the Mac machine.
2- Application called "W": An app written in let's say Visual Studio that run on Windows machine.

All I want for this two applications is to talk to each other for example through messaging. For example consider this simple scenario:

1- "M" running on Mac send a message to "W" running on Windows saying "PERFORM TASK A".
2- "W" performs the task
3- ""W" send message to "W" saying "TASK A DONE"
.....


Both Mac machine and Windows machine are on the same network.
Also please note that I am not concerned bout security of communication at this time.

My problem is I don't know where to start from?

Any suggestion for where to start from, technologies, sample codes, etc that help me get started is highly appreciated.

Thanks,

KylieM
 
Bonjour is a discovery protocol. It isn't designed for communication as you describe. It can be handy. Apple had released a Bonjour framework for Windows in the past but their version may be out dated. There is a secondary non-Apple name it that I don't recall. Check Wikipedia.

Sounds to me like you'd like to create you own protocol. Your going to do some low level port communication. Each tool set likely has its own framework to ease that pain. For OS X look for the networking tools; such NSStream, NSURLConnection and the new NSURLSession.
 
Why would you be writing these programs? Is it to learn how to do it? Or is it to use the capability they provide?

That is, if you didn't have to write any program at all, and could use an existing application, would that solve the problem?


The description you provided is basically equivalent to the SSH protocol, or the Telnet protocol. Read about them here:
http://en.wikipedia.org/wiki/Secure_Shell
http://en.wikipedia.org/wiki/Telnet

There are Telnet and SSH clients and servers that already run on both Macs and Windows. If your goal is only to use the capability, rather than write it yourself, you can search for SSH or Telnet programs for each platform.

Both SSH and Telnet typically have command-line versions. That means they can be scripted or automated, as well as used interactively. OS X has command-line versions of telnet, ssh, and other network program pre-installed. You can read their man pages here:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ssh.1.html
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/telnet.1.html

Another network-communication program is 'netcat'. It's very flexible, and may be a simpler solution than either Telnet or SSH:
http://en.wikipedia.org/wiki/Netcat
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/nc.1.html

It shouldn't be difficult to google ssh, telnet, and netcat versions for Windows.


If your goal is to learn how to make these programs, then the first thing you need to do is learn about network programming, specifically TCP/IP. The fundamental principles will be the same across all platforms, but the specific details will vary by platform and programming language. That is, TCP/IP sockets in C on the Mac will differ from the same feature in C# on Windows, and so on for other languages.

Some programming languages may provide high-level features, where all the programmer needs to do is ask to open a connection to a target host on a specific port, and the language takes care of all the details. In other words, you might have the equivalent of 'netcat' in the programming language itself.

Again, if your goal is learning rather than using, then you need to start with TCP/IP network programming. That's the foundation everything else builds on, so you need to have a solid understanding of how it works. You should be able to build a networking program entirely on Windows (i.e. Windows-to-Windows) before venturing onto the Mac. Once you have the basics down, it's just a matter of translating. Without the basics, you've got nothing to build from.
 
All I want for this two applications is to talk to each other for example through messaging. For example consider this simple scenario:

1- "M" running on Mac send a message to "W" running on Windows saying "PERFORM TASK A".
2- "W" performs the task
3- ""W" send message to "W" saying "TASK A DONE"
.....

You should probably be more specific about what you are trying to do here. If you are trying to offload work from one computer to another for example, then that sounds like a remote procedure call, or equivalent, maybe a distributed computing platform.

In any case there are a ton of protocols available that does this already. Have a look at published RFCs to get an idea, but perhaps start by reading up on networking.

When you know what you need, you can start looking into platform specific APIs to implement this, which may well be some library that already wraps an existing protocol. Or you can write your own if you have a specific need.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.