Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ReadFile freezing

Posted on 1998-02-04
1
Medium Priority
?
476 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

715 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