Jump to content
Xtreme .Net Talk

Need to use 2 Mailslots to communicate between local applications? [C++ & C#]


Recommended Posts

Posted

Currently I have 2 applications that reside on the same system (local applications) that need to communicate. One is a C++ program that already uses mailslots to communicate with other system (remote) and the other is a new C# service I have just written.

 

Given that the C++ application is already mailslot savy I thought it would be a good idea to re-use the logic for local process (IPC) communication (why not...). But while implementing it I ran into a situation and am wondering if this was the correct "way to go"...

 

Correct me if I am wrong but ... don't I need 2 mailslots? One for communication from the C++ application -> C# service and another separate one from the C# service -> C++ application? Given that mailsots are simply files if both write to \\.\mailslot\name and both read from \\.\mailslot\name ... well my assumption is this won't work ... The C++ will write to the mailslot and just read-in the message it just wrote no?

 

Is there a proper way to implement this when using local mailslots?

I would have assumed a single-channel of communication would be best but ... if this is the standard approach I'll go with it :)

 

 

The C++ application must sent commands to the C# service and then recieve responses (return codes) from the C# service.

Now, this is for small amounts of data transfer, for example the C++ sends message "CHECK" every 10 minutes to C# service, and the service responds with a return code 0x10010010 or something appropriate (for example).

 

Any help or advice would be much appreciated.

Thanks,

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...