473,231 Members | 1,752 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,231 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 7619
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: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.