Solved

CreateNamedPipe on Windows 95

Posted on 1998-07-17
11
278 Views
Last Modified: 2013-12-03
How can I create a named pipe on Windows 95?  A named pipe would be perfect for what I am trying to do, but my application must run on 95 AND NT.  What are my options here?
0
Comment
Question by:tkirby052098
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 8

Expert Comment

by:trestan
ID: 1410482
Please refer to the following instruction and sample codes:
http://devcentral.iftech.com/learning/tutorials/nt/nt3.asp
0
 

Author Comment

by:tkirby052098
ID: 1410483
Thanks for your attempt, trestan, but this does not answer my question.  Please allow me to clarify my question:

The functions CreateNamedPipe and ConnectNamedPipe are *not* supported by Windows 95.  These functions are necessary to create and connect to a named pipe in a server under Windows NT.   My question is how to simulate the behavior of these functions in Windows 95 only.  CreateFile will open an _existing_ pipe created by NT, but appearantly cannot create a new named pipe.
0
 
LVL 2

Expert Comment

by:warmcat
ID: 1410484
Kirby, as you indicate you are on a hiding to nothing with named pipes and '95.  Instead, one way through the mess which works on DOS, 95, 98, and NT, is mailslots.  There is a CreateMailslot API a la CreateNamedPipe.  There are various gotchas and caveats when using them, including multiple datagram delivery if there is more than one protocol connecting the nodes, and a hard limit on datagram length.  But the thing works: I have apps here using the technique.  Go to the following (huge) URL for more details:

http://search.microsoft.com/searchbin/mssearch.idq?MSCOM_SRV=http%3A%2F%2Fwww.microsoft.com&SearchKB=none&CiMaxRecordsPerPage=10&CiSort=rank%5Bd%5D&HTMLQueryForm=http%3A%2F%2Fwww.microsoft.com%2Fsearch%2Fdefault.asp%3FSPath%3D%5Cpremium%5Cmsdn%5Clibrary%26SName%3DMSDN%2BOnline%26CiTemplate%3D&IDQFile=%2Fsearchbin%2Fmssearch.idq&CiTemplate=&SearchCountry=@Locale+en-us&DisplayString=mailslot&SearchType=microsoft&SearchString=mailslot+AND+%28+%23PATH+*%5Cpremium%5Cmsdn%5Clibrary*%29&SName=MSDN+Online&SearchArea=%5Cpremium%5Cmsdn%5Clibrary&Finish=Search+Now%21&x=41&y=8
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:tkirby052098
ID: 1410485
First, what does "on a hiding to nothing" mean?

Did I mention that I also need near-real-time speed?  Mailslots are too slow.

Creating a named pipe should be a matter of creating the pipe object and filling it with the "right stuff".  

0
 
LVL 6

Expert Comment

by:alamo
ID: 1410486
Actually, the real answer to your original question is to use TCP/IP sockets. (Mailslots might work too, I have never used them, but you already rejected that answer). Named pipe servers are simply not supported on 95. You have to create the named pipe on an NT machine.

TCP/IP sockets are a mechanism close to named pipes in terms of being able to set up a server which can accept multiple connections from clients over the network.

If you only need fast interprocess communication on a single machine, WM_COPYDATA is your best bet, but you imply you need intermachine communication.
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1410487
Why don't you create a simple file with shared access on a server which can be accessed by
both machines? It will be held in cache if it is accessed often, so it should not be too slow.
0
 

Author Comment

by:tkirby052098
ID: 1410488
I am using mapped file i/o now, as a sort of temporary solution.  I works okay, and the speed is acceptable, but other application constraints would seem to make the pipe solution look better.  At least, I'd like to try it.  Besides, I don't want to do this the same way our competition does it.  :-0
0
 
LVL 5

Expert Comment

by:laeuchli
ID: 1410489
Windows 95 apps can read named pipes they justs can't make them. so why don't you make your porgram use named pipes if it's running on nt and files if 95?
0
 

Author Comment

by:tkirby052098
ID: 1410490
Sorry,  you didn't answer my question.  You just said that as far as you know, it cannot be done.  That does not mean it's impossible.
0
 
LVL 6

Accepted Solution

by:
alamo earned 50 total points
ID: 1410491
It is impossible to create a named pipe under Windows 95. There is no workaround to establish intermachine communciations using named pipes when all machines are Win95. You need to use a different method of interprocess communication.
0
 
LVL 3

Expert Comment

by:RJSoft
ID: 11866736
You could replace the functionality of the named pipe just by writing to a file.

For each itteration of your process write the values to the file. Overwrite for each itteration.
Seperate the values if you wish with a delimitor like a comma. Flag the end of the written data with some unique char string so to acknowledge that the record has been written.

Ex.
Data is a string. Wrote to file pipe.txt
"Processing byte 32,Stereo,56,325 remaining bytes,abcd"

The abcd is a flag that signifies that the record has been completed.

Now in your visual side, use a timer or thread to poll the file pipe.txt Seperate the values and then display them in your controls. (Probably just a Static). If you use a timer to pump the values to the visual part to screen you will need a flag to signify when the process starts and ends.


Pseudo:

Call function to produce something.

In function set flag to indicate process has started.

In function process where output is expected to be shown visually, write visual element to file. (pipe.txt) If repeated itteration, over-write file.

In display portion of code. Use timer to poll for completed file, (read and search for "abcd")
if "abcd" found then update visual components, else do nothing.

When function process ends turn off timer flag.

If this functionality is to be between two different machines then pipe.txt will need to be a shared access file.

RJ







If you use a timer
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question