473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Use of Named Pipes in .Net

Is there any built-in facility for handling named pipes in C#/.Net, or must
one use unsafe code to access the WIN32 API directly?

There exists some code that uses named pipes heavily and there exists a need
for that code to send some information to a new .Net service I am writing.
It is a relatively simple matter for the existing code to use a named pipe
to send the data, but I can find no references to how I can create the named
pipe and manage it from the .Net side.

-Ken
Nov 16 '05 #1
4 7633
Ken,
Is there any built-in facility for handling named pipes in C#/.Net,


No

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2

"Ken Allen" <ke******@sympatico.ca> wrote in message
news:eI**************@TK2MSFTNGP09.phx.gbl...
Is there any built-in facility for handling named pipes in C#/.Net, or must one use unsafe code to access the WIN32 API directly?

There exists some code that uses named pipes heavily and there exists a need for that code to send some information to a new .Net service I am writing.
It is a relatively simple matter for the existing code to use a named pipe
to send the data, but I can find no references to how I can create the named pipe and manage it from the .Net side.


You must use Win32 to create or open the named pipe, but once you have a
handle to the named pipe, you can just wrap it in a System.IO.FileStream to
read and write.

To replicate the example here
http://msdn.microsoft.com/library/de...ipe_server.asp

for a mutithreaded pipe server, it looks like you'll need to call

CreateNamedPipe
ConnectNamedPipe
DisconnectNamedPipe
CloseHandle

through P/Invoke.

The FileStream will take care of ReadFile, WriteFile, FlushFileBuffers and
CloseHandle on the connected pipe instance.

David
Nov 16 '05 #3
Unfortunate. I did read the other response concerning using the CreateFile()
API call first, but...

Am I correct in my believe that a simple TCP/IP socket should be no problem
for this type of solution? The existing C++ (not .Net) service could send
the data buffer over the TCP/IP socket and the .Net service could create and
receive over the socket?

-Ken

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
Ken,
Is there any built-in facility for handling named pipes in C#/.Net,


No

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #4
"Ken Allen" <ke******@sympatico.ca> wrote:
Is there any built-in facility for handling named pipes in C#/.Net, or must
one use unsafe code to access the WIN32 API directly?

There exists some code that uses named pipes heavily and there exists a need
for that code to send some information to a new .Net service I am writing.
It is a relatively simple matter for the existing code to use a named pipe
to send the data, but I can find no references to how I can create the named
pipe and manage it from the .Net side.

-Ken


Item 13.13 Using Named Pipes to Communicate
http://cookbooks.oreilly.com/

Source Code is here
http://examples.oreilly.com/csharpckbk/
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matt W | last post by:
Hi all, I just noticed this in the manual yesterday: http://www.mysql.com/doc/en/Windows_running.html "MySQL supports TCP/IP on all Windows platforms. The mysqld-nt and mysql-max-nt servers...
5
by: rajnish | last post by:
Hi Gurus, I am a newbee in C++ field. And I have been assigned to complete a task of create a template class, so that names pipes can be created using this template. I don't have a clue from...
5
by: glenn.owens | last post by:
In the process of doing some routine monitoring/clean-up we've discovered that several (many?) users are apparently set to access our SQL Server 2000 database instances via the Named Pipes...
2
by: Rudolf Bargholz | last post by:
Hi, DB2 7.1 FP11 Windows 2000 Earlier this evening, after dropping and recreating a trigger, DB2 locked up. I am not entirely sure that the cause of the problem was the replacing of the...
1
by: Jarrod Morrison | last post by:
Hi All Im looking for a way use named pipes between a service app and an app run when a user logs on and be able to pass string based data, im hoping that the service can contact the app that is...
1
by: Jarrod Morrison | last post by:
Hello all Ive been trying to get a service app that i run to interact with the logged on user of the machine and so far havent been very successfull and have read that maybe named pipes is the...
2
by: fahad.usman | last post by:
I am making an application in which if the second instance of the same application is launched, it checks its command-line arguments and passes them to the already running instance. I have been...
1
by: dgk | last post by:
I trying to use a named pipe but can't figure out how to get the callback to work: Module Module1 Private ps As System.IO.Pipes.NamedPipeServerStream Public Sub main()...
7
by: andrewb | last post by:
Hi all, Having some trouble using named pipes and Visual Basic .NET and would appreciate and help you could offer. Essentially I am trying to develop a simple client/server application that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.