user936597
user936597

Reputation: 191

How to communicate between two different WPF application over LAN?

I want to communicate between two different WPF windows. The WPF UI in first computer generates some data and add to a database table, then it generates a message which includes the unique ID of the new data in the table and forwards it to the another computer. Upon receiving the message with unique ID by same computer, it queries for that data in it and displays in it's UI.

I don't want the WPF application in the second computer to repeatedly (timer based) check the database. Instead I want to have some event listener in this application which just initiates an action upon receiving the message.;

Everything is being operated in LAN where, obviously, two computers are connected within the same network.

A suggestion and better solution will be a great help.

Upvotes: 3

Views: 2770

Answers (3)

KingCronus
KingCronus

Reputation: 4519

Microsoft have provided a framework for this very purpose:

https://msdn.microsoft.com/en-us/library/ms731082(v=vs.110).aspx

WCF has a variety of flavours dependant on your specific requirements, the link above is a good place to begin your research.

Upvotes: 2

Naresh Goradara
Naresh Goradara

Reputation: 1896

There are various ways to communicate over LAN:

  1. TCP Listener
  2. UDP
  3. MSMQ
  4. Remoting

You can choose as per your requirement.

Upvotes: 0

Sandeep
Sandeep

Reputation: 7334

So WPF1 generates ID and WPF2 has to know about it.

Expose WPF2 as a Webservice. Consume the webservice in WPF1.

When ever WPF1 generates ID, it inserts the ID and invokes the WPF2 Webservice.

Upvotes: 2

Related Questions