Interprocess communication in Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    Interprocess communication in Windows

    Hi all,

    I am very new to Implementation of the Interprocess communication.I am trying to implement the concept in c++.I created the pipe using Createnamedpipe () function ,connecting to that pipe using ConnectNamedPip e() function and then reading the file created on the file at one end.

    But I am bit curious about the how the process/user at the other end of the pipe will communicate with the my terminal.How the things goes in the background..?

    Can anyone help me ?

    Thanks!
    :)
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by madankarmukta
    Hi all,

    I am very new to Implementation of the Interprocess communication.I am trying to implement the concept in c++.I created the pipe using Createnamedpipe () function ,connecting to that pipe using ConnectNamedPip e() function and then reading the file created on the file at one end.

    But I am bit curious about the how the process/user at the other end of the pipe will communicate with the my terminal.How the things goes in the background..?
    A (named) pipe is a classic example of a producer/consumer scenario. A pipe is a buffer that serves as a queue; the producer writes to one end and the consumer reads from the other end.

    If the buffer is full the producer is blocked; the consumer is allowed to run. If the buffer is empty the consumer is blocked and the producer is allowed to run. Anywhere in between both are allowed to run but the access to the buffer is monitored by a mutex; i.e. if one party is accessing the buffer, the other party is temporarily blocked.

    Both the producer and the consumer are processes handled by the OS. The pipe can be a buffer in memory or an actual entry in the file system.

    kind regards,

    Jos

    Comment

    • madankarmukta
      Contributor
      • Apr 2008
      • 308

      #3
      Originally posted by JosAH
      A (named) pipe is a classic example of a producer/consumer scenario. A pipe is a buffer that serves as a queue; the producer writes to one end and the consumer reads from the other end.

      If the buffer is full the producer is blocked; the consumer is allowed to run. If the buffer is empty the consumer is blocked and the producer is allowed to run. Anywhere in between both are allowed to run but the access to the buffer is monitored by a mutex; i.e. if one party is accessing the buffer, the other party is temporarily blocked.

      Both the producer and the consumer are processes handled by the OS. The pipe can be a buffer in memory or an actual entry in the file system.

      kind regards,

      Jos
      Hi Jos ,
      Thanks for giving quick reply.

      So from the scenario which i described in my post, reflect that I created the producer.. I am not sure how to implement the consumer. Can anyone help me ?

      Thanks!

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        In the consumer you call CreateNamedPipe to either create a new pipe or create an instance of an existing named pipe (i.e. open a handle onto an existing pipe) or CreateFile to create an instance of an existing named pipe. You can use ReadFile and WriteFile to read and write data to the pipe.

        I suggest you read the pipe reference Pipes (Windows)

        Comment

        Working...