I have two Windows services, the first one written in C# and the second written in unmanaged C++, I want to know how can I do two-way interprocess communication.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the interprocess communication is always going to be done on the same machine, named pipes is the way to go because they are faster than other options.
However, if there is even the slightest chance that this communication might occur across machine boundaries at some point, go with the socket approach. For C++, you’ll need the winsock2.h header file. In C#, use the
System.Net.Socketsnamespace.It’s been a while since I’ve done unmanaged C++, but my recollection is that you’ll have to write less C++ code if you create the server on the C++ side and then use the
TcpClientclass on the C# side.