Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Communication between two different applications

We have two applications running on single machine,one of which is web application that responses every request by reading xml document(s).We wish to add the case that when the new xml file is created or existing file has replaced,application must not read file until its all changed and by the time the case happens,it must respond with old file.

Since web applications works for request/respond cycle,we decided that this cycle shouldn't be interfered knowing that time between file changing and request time is obscured in live-running system,we must split file reading process.For that purpose,we use FileSystemWatcher in local machine with windows or console application(or some other says use WCF instead).

Now that we come to question in above case,saying how can we communicate these two (or more) applications?

like image 417
Myra Avatar asked Apr 15 '11 12:04

Myra


People also ask

How do you communicate between two apps?

Android inter-process communication At the simplest level, there are two different ways for apps to interact on Android: via intents, passing data from one application to another; and through services, where one application provides functionality for others to use.

What is application communication?

Communicating with Applications (Application to Application Communication) Your application can communicate with another application that runs in a virtual machine on the same system as your application, on a different z/VM system, or within a Systems Network Architecture (SNA) defined network.

How do I communicate between two applications in Linux?

A message queue is a one-way pipe:one process writes to the queue, and another reads the data in the order it was written until an end-of-data condition occurs. When the queue is created, the message size (bytes per message, usually fairly small) and queue length (maximum number of pending messages) are set.

Can Android apps communicate with each other?

Android apps are screened for viruses and other security issues before being listed in the Google Play store, but only individually. Once downloaded, apps can communicate with each other without notifying the user.


1 Answers

Look like you'd be interested in Named Pipes to enable IPC, check out this link for an example, or this MSDN link.

Grabbing the code from the NamedPipeServerStream page of MSDN illustrates most simply (see the NamedPipeClientStream page for the client side):

using (NamedPipeServerStream pipeServer =
    new NamedPipeServerStream("testpipe", PipeDirection.Out))
{
    Console.WriteLine("NamedPipeServerStream object created.");

    // Wait for a client to connect
    Console.Write("Waiting for client connection...");
    pipeServer.WaitForConnection();

    Console.WriteLine("Client connected.");
    try
    {
        // Read user input and send that to the client process.
        using (StreamWriter sw = new StreamWriter(pipeServer))
        {
            sw.AutoFlush = true;
            Console.Write("Enter text: ");
            sw.WriteLine(Console.ReadLine());
        }
    }
    // Catch the IOException that is raised if the pipe is broken
    // or disconnected.
    catch (IOException e)
    {
        Console.WriteLine("ERROR: {0}", e.Message);
    }
}
like image 96
Grant Thomas Avatar answered Oct 20 '22 08:10

Grant Thomas