Thank you very much for your prompt response.
I got the sampe code for C# and C++ from the web. They work when both client and server are in C# or when both are in C++. When I use the C# client and the C++ server, the client fails to connect to the C++ server. I then change the parameters of the CreateNamePipe in the C++ server to match the ones in the C# server. Still, the connection fails!
I got the C++ sample code from the article "Simple Point to Point Communication Using Named Pipes" at Codeguru.
I got the C# sample code from the article "Inter-Process Communication in .NET Using Named Pipes" at ivanweb.com.
Thanks again for your help.
Main Topics
Browse All Topics





by: itsmeandnobodyelsePosted on 2009-09-02 at 02:29:39ID: 25239189
>>>> Can a NamedPipe client written in C# send message to a NamedPipe server written in C++?
Yes, Named Pipe is a system resource which can be addressed by any programming language which allows to using runtime libraries or WINAPI functions.
>>>> Please show an example if this is doable. I
Unfortunately my C# knowledge is small.
>>>> I receive error code 2 when the NamedPipe client tries to connect to the NamedPipe server.
Error 2 means" file not found". In C# strings are UNICODE (two-byte character set) while in C++ normally it is ANSI (multi-byte character set). That could be a problem for naming the pipe properly.
Can you post the code lines of both server and client where you create or open the named pipe?