I have 2 windows form applications. 1st application interacts with database while the other application is aimed to communicate with the 1st application to interact with the database.
So how can I interact two applications with each other. Which tool should I use?
Here is a good example using WCF to communicate two processes:
http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication
Another option is ZeroMQ C# binding:
http://www.zeromq.org/bindings:clr
One option would be to use WCF named pipes (net.pipe) the other option would be Anonymous Pipes for Local Interprocess Communication
Excerpt:
Anonymous pipes offer less functionality than named pipes, but also
require less overhead. You can use anonymous pipes to make
interprocess communication on a local computer easier. You cannot use
anonymous pipes for communication over a network.
Use WCF with netnamedpipe binding as #I4V recommends. Other alternatives are use Pipes, Remoting, or fileshare.
Related
What's the 'correct', or at least 'typical' way to communicate with a Windows service running locally?
I can see that it's pretty trivial to use WCF to open a HTTP or TCP endpoint, but both these are really network protocols.
What protocol should I choose to invoke methods and receive responses from a local windows service?
You can use:
Socket communications (TCP, HTTP, or other): even though you say they are network protocols the advantage is that you might already know them
Named pipes: this is a good option for communication between processes running in the same node: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365590(v=vs.85).aspx
shared memory: this is the fastest
Other third party, higher level, library like Thrift which uses sockets
I'm trying to do some research on tcp client and tcp listener in c# for a microsoft exam. I've found quite a lot on the internet about how to use them, but very little about why I should use them.
I've discovered that it's a secure way of communicating between 2 applications, but I don't get why I should use tcp instead of (for example) just exposing a method on one application and calling it from the other.
Does anyone know of any good webpages that might be able to explain this to me?
If you are intending to communicate between applications with in a system you can use any inter process communication methods. But if you intend to have two applications running in different machines than you need a mechanism outside of IPC. This is where TCP and UDP come into picture.
TCP/UDP are elaborate protocols(rules) that govern how the two applications connect, exchange data and terminate the connection. (UDP , does not have the connect/terminating phase, BTW.)
Its interesting. Start with Wiki.
Most start socket programming with this well known page (In 'C' though) - http://beej.us/guide/bgnet/
I'm pretty new in C# and I'm developing C#(WPF) application with client/server architecture, and I'll need to communicate between two machines(only short JSONs, however a lot of them), and HTTP is too "heavy" with all it headers etc. Does exist any alternative to HTTP on application layer?
Sure, why not use WCF.
That way you can specify the type of communication method, named pipes, shared memory, http, tcp etc.
http://msdn.microsoft.com/en-us/library/dd936243.aspx
I want to create a communication between a windows service and a desktop application on Windows 7.
I read that named pipes are one way for communication between two processes. Can i use them for my purpose?
sure you can use named pipes, WCF many other IPC methods.
for named pipe example among stack overflow questions, see here as well for some backgound:
Inter process communication using Windows service
also check this one: GUI and windows service communication
As indicated above, there are lots of options available. Just be aware that if you go the TCP/IP route (e.g. WCF), the user will have to have a valid network connection (a loopback adapter will work) otherwise your client and service won't be able to communicate.
Go with WCF, it's a good solution to start.
One solution is to use EMS and communicate back the variables. Any other possible way?
You can try to implement this by using:
IPC (Inter Process Communication via Named pipes)
Shared memory (Memory mapped files)
Socket (TCP/IP)
Example of using WCF: Many to One Local IPC using WCF and NetNamedPipeBindin
Other example: A C# Framework for Interprocess Synchronization and Communication
Everything depends on what version of .Net Framework you use. If you use .net 3.0. and above then you can take a look into WCF. If not then you are on your own and you can google on keywords P/Invoke (CreateFileMapping, MapViewOfFile, CreatePipe...)
You named it. Remoting is your friend. Unless you are using .NET 3+, in which case WCF should be preferred.