Solved

ReadFile freezing

Posted on 1998-02-04
1
471 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

627 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