Solved

ReadFile freezing

Posted on 1998-02-04
1
467 Views
Last Modified: 2013-12-03
I have a pipe which i'm reading from with ReadFile()...everything is fine as long as there is data in the pipe, but if the writing function never puts data in the pipe, ReadFile() never returns and leaves the program hanging.  How can I stop ReadfFile from doing this or test to see if there is data in the pipe

P.S. I'm using VC++ 5 under win95
0
Comment
Question by:openGL
[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
1 Comment
 
LVL 1

Accepted Solution

by:
yl earned 200 total points
ID: 1410880
You can use the PeekNamedPipe function to determine if there is data to be read from the pipe.
Alternately you can use overlapped i/o by using the FILE_FLAG_OVERLAPPED in the pipe creation in CreateNamedPipe. In that case the ReadFile operation will perform asynchronously and will return immediately if there is nothing to read.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…

752 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