Solved

ReadFile freezing

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now