overlapped-io

Boost asio async vs blocking reads, udp speed/quality

I have a quick and dirty proof of concept app that I wrote in C# that reads high data rate multicast UDP packets from the network. For various reasons the full implementation will be written in C++ and I am considering using boost asio. The C# version used a thread to receive the data using blocking reads. I had some problems with dro...

Serial port and handling errors during overlapped I/O operations

I've been doing serial communications lately so I prepared a class being a simple interface to all those Windows API functions responsible for reading, writing, etc. All I/O operations inside this class are handled asynchronously. Before I go to my question, let me show you how I write and read data from serial port (this is only the re...

Async IO across processes

All: I am writing a logging solution. One of the available log endpoints is a text file. Suppose I wanted to write to that file from multiple processes: I could open it shared, and use a named mutex to control concurrent access to the file (assuming all access occurred on the same machine). But then I started wondering about async I...

c# Named Pipe Asynchronous Peeking

Hey all, I need to find a way to be notified when a System.IO.Pipe.NamedPipeServerStream opened in asynchronous mode has more data available for reading on it- a WaitHandle would be ideal. I cannot simply use BeginRead() to obtain such a handle because it's possible that i might be signaled by another thread which wants to write to the p...

C# and native overlapped I/O

I have a C dll that I'm wrapping so that I can call it from C#. One function uses events to notify you when a state has changed, and figuring out to deal with it took some digging. It seems to be working ok, but I'm curious if anyone has more experience with this than I do and can offer any advice. The function is defined in the dll's ...

Canceling a WinUSB asynchronous control transfer

For a user application (not a driver) using WinUSB, I use WinUsb_ControlTransfer in combination with overlapped I/O to asynchronously send a control message. Is it possible to cancel the asynchronous operation? WinUsb_AbortPipe works for all other endpoints but gives an 'invalid parameter' error when the control endpoint is passed (0x00 ...

Reading a whole file on a network drive the fast way (Windows, C/C++, C#, ...)

Lately I've been having problems reading big files on a network drive and I just can't pinpoint what I may be doing wrong. I tried both in C++ (Unmanaged) and in C# and had about the same performances on both...which were somewhat abysmal. Sometimes it will read at 4 KB/s a file on the network, but if this file is located on the local H...

According to MSDN ReadFile() Win32 function may incorrectly report read operation completion. When?

The MSDN states in its description of ReadFile() function: If hFile is opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must point to a valid and unique OVERLAPPED structure, otherwise the function can incorrectly report that the read operation is complete. I have some applications that are violating the above recommend...

Is it possible to change HANDLE that has been opened for synchronous I/O to be opened for asynchronous I/O during its lifetime?

Dear all, Most of my daily programming work in Windows is nowadays around I/O operations of all kind (pipes, consoles, files, sockets, ...). I am well aware of different methods of reading and writing from/to different kinds of handles (Synchronous, asynchronous waiting for completion on events, waiting on file HANDLEs, I/O completion p...

hEvent member in OVERLAPPED Win32 structure

When asynchronous I/O (or "overlapped" I/O in Win32 jargon) is used, we need to deal with the OVERLAPPED structure and his hEvent member. If the I/O function will delay the read or write operation, we will get an ERROR_IO_PENDING error code, then we will wait the asynchronous operation to complete with a WaitForXxxEvent function, then we...

how to avoid overlapping of checkboxlist with listbox

My code conatins the following CheckBoxList in a div which is invisible. Onclik on select box image, div with checkbox list is visible under the select box. How i can display my checkbox list overlapping all the other controls and display at the top. ...

When are IO completion port packets sent and when not?

I'm currently working on an IPC mechanism based on named pipes using a IO completion port. Unfortunately I have some troubles with the msdn documentation because it's quite unclear to me in which cases calls to ReadFile/WriteFile result in a completion packet. The case when FALSE is returned with ERROR_IO_PENDING is clear, but what abo...

Timer that supports overlapped I/O (for IOCP) ?

Hello, I need to add timers support in an application based on I/O Completion Ports (IOCP). I would like to avoid the use of a specific thread to manage timers. On Linux, you can create a timer that delivers expiration notifications via a file descriptor (see timerfd.h man), so it's great to use it for example with epoll if your applic...

WSASYSCALLFAILURE with overlapped IO on Windows XP

I hit a bug in my code which uses WSARecv and WSAGetOverlapped result on an overlapped socket. Under heavy load, WSAGetOverlapped returns with WSASYSCALLFAILURE ('A system call that should never fail has failed') and my TCP stream is out of sync afterwards, causing mayhem in the upper levels of my program. So far I have not been able to...

Calls to ReadFile return ERROR_WORKING_SET_QUOTA

The program runs fine for a few minutes and then ReadFile starts failing with error code ERROR_WORKING_SET_QUOTA. I'm using ReadFile with overlapped I/O like so: while (continueReading) { BOOL bSuccess = ReadFile(deviceHandle, pReadBuf, length, &bytesRead, readOverlappedPtr); waitVal = WaitForMulti...

Windows NAmed Pipes alternative in Linux

Hi, We are porting existing windows code to Linux. We are using ACE as abstraction layer. We are using windows named pipes for communicating with multiple clients and to perform overlapped operations . What is the equivalent to this in linux. I have checked linux named pipes(FIFO), but they seem to support only one client and server an...

Is it normal for WSASend to fail during big file transfers?

I need a little help if someone's got a minute. I've written a web server using IO completion ports, but I am having some trouble sending out large files. Web pages seem to load fine, but during large file transfers, WSASend() fails after a few minutes with error "The specified network name is no longer available." Right now, my server ...

WriteFile() call works on x86, but not x64. Getting error code 6 -- The handle is invalid using VB.NET

I am using CreateFile, WriteFile and ReadFile API calls to write some data to a USB device. The code I have works perfectly on 32 bit systems. CreateFile gets a handle to the device, pass that handle and some data to WriteFile and read from that handle with ReadFile. My problem is, the same code does not work on a 64 bit system. The err...