PedroC88
PedroC88

Reputation: 3838

Communicating to Applications on LAN

I want to code an app with recreational purposes. This should be a Desktop app that detects itself running on other computers on the same LAN and communicates with them. By communication I mean that I should be able to pass anything from on to another.

Please note that although I'm not asking for code (that would beat my purpose, of course) I think some small snippets wouldn't hurt. In any case what I really want is the "recommended procedure", I mean what Microsoft recommends for this environment, and documentation :)

Upvotes: 1

Views: 3741

Answers (3)

Ragesh
Ragesh

Reputation: 3073

If this is your first ever network application, you should start with sockets so you can understand and appreciate the issues involved in building an app like this from scratch. Effectively, what you are trying to build is a peer-to-peer application. There are many things you'll want to think about and research here, like:

  1. Peer discovery -- detecting other instances on the network and figuring out if they're still online or not
  2. Messaging -- designing an on the wire protocol for your app
  3. Security -- things like encryption, preventing replay attacks, etc.

Eventually (once you've understood the underlying concepts), you will want to defer all of this to a framework rather than developing everything from scratch. I think WCF peer-to-peer will fit your needs.

Upvotes: 3

Xaqron
Xaqron

Reputation: 30887

As Taz said socket programming is the best choice but you can use other solutions like WCF (not recommended normally).

About finding other instances on the LAN I could say you need some scanning algorithm. Most worms have such an algorithm for spreading. You should consider many networking issues like open ports on target LAN and firewall restrictions.

Another point could using a TCP port over 5000 (up to 65535, but don't use famous ports) since ports under 5000 are subject to be used by operating system.

Also to need your own protocol over TCP/IP for messaging/commanding and data transfer between peers.

At the end it's a good idea to have a hand from a networking/security consultant in this kind of projects since most problems you encounter are not about programming but networking.

Upvotes: 2

Tasawer Khan
Tasawer Khan

Reputation: 6148

Socket programming? Make them listen on a specific port and whenever application starts it should connect to that socket and the they are both connected. I am not sure how should application search for other application instances running on LAN.

Upvotes: 1

Related Questions