Questions tagged [overlapped-io]

138 questions
0
votes
0 answers

ReadFile Overlapped access - Error 170 (resource is in use)

my goal: I`m writing an application which writes a file to the serial port 128 bytes at a time (137 total, with ModBUS header and CRC) and waits for the reply. The writing I have managed to implement successfully. After sending a 137 byte packet I…
0
votes
0 answers

Is it possible to use Windows Overlapped IO to wait for another process to write to a file?

Say I want to write a tail like application for Windows to monitor a bunch of files. Such an application should report when some of the monitored files is updated by any other application. It can be assumed that the files being monitored are being…
Tarc
  • 3,214
  • 3
  • 29
  • 41
0
votes
1 answer

Two sockets that ConnectEx to the same IP address and port produce duplicate IOCP events

I have a client application that uses IOCP for socket communication. I'm using ConnectEx to make the TCP connection to the remote endpoing (binding the socket to ADDR_ANY and port 0 before calling ConnectEx). It will be valid to have two connections…
Ken
  • 427
  • 4
  • 20
0
votes
0 answers

Can't pass OVERLAPPED object to WSAGetOverlappedResult

I'm trying to develop req/res server by using overlapped io according to this example. The problem is that in the same time there could be multiple sends to the same socket and I can't pass overlapped structure to the WSAGetOverlappedResult to…
htonus
  • 629
  • 1
  • 9
  • 19
0
votes
3 answers

Application Not Receiving Serial Data from COM Port - C++

My application is not properly receiving data from the COM port. This used to work. I don't know what happened. I know that the proper data is being sent/received over the line because I can see it on my protocol analyzer. The PC gets into the…
Jim Fell
  • 13,750
  • 36
  • 127
  • 202
0
votes
2 answers

How do I use Overlapped structure with WriteFile API in VB .Net

I use VB .Net to call the Kernel32.dll WriteFile API: Public Declare Function WriteFile Lib "kernel32" _ ( _ ByVal hFile As IntPtr, _ ByVal lpBuffer As Byte(), _ …
N00b
  • 29
  • 5
0
votes
2 answers

AcceptEx returns 1022 (WSAEINVAL)... What did I do wrong?

I am trying to code a small test-server for completion ports. But when I try to call AcceptEx... it always returns WSAEINVAL as the winsock error code... I don´t really get what was my mistake http://codepad.org/NEXG3Ssh <- code on…
Juarrow
  • 2,232
  • 5
  • 42
  • 61
0
votes
3 answers

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…
Brandon
  • 4,491
  • 6
  • 38
  • 59
0
votes
1 answer

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,…
Tom Hennen
  • 4,746
  • 7
  • 34
  • 45
0
votes
1 answer

How to signal file HANDLE waiting with WaitForSingleObject

This code, which I have no control over, reads a file using overlapped I/O: // Read file asynchronously HANDLE hFile = CreateFile(..., FILE_FLAG_OVERLAPPED, ...); BYTE buffer[10]; OVERLAPPED oRead = { 0 }; ReadFile(hFile, buffer, 10, NULL,…
0
votes
2 answers

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…
eile
  • 1,153
  • 6
  • 18
0
votes
0 answers

How can WaitForMultipleObjectsEx timeout before ReadTotalTimeoutConstant?

I have a program that reads from a serial port this is done with overlapped IO. I can not understand how the WaitForMultipleObjects can timeout (200 ms) when I have a lower timeout in the SetCommTimeouts (100 ms) call. It only happens very rarely.…
Kennet
  • 323
  • 4
  • 12
0
votes
1 answer

WSASend completion routine has never been called

I'm playing around with Overlapped IO and suddenly found out that it looks like I'm the only one who can't encourage Completion callback to work (All claims was about: it works and I don't like it). The idea of my application is: a client (telnet…
0
votes
1 answer

Linux Overlapped I/O TCP socket server not responsing to C# ASync Client correctly

I am trying to code a simple functioning echo socket client/server. I have managed to get a Synchronous server with a client to work, but now I need an asynchronous. If I use Microsofts versions it is functioning good, ASync…
Peter Wirdemo
  • 498
  • 2
  • 11
  • 25
0
votes
1 answer

C++ serial library's use of Win32 synchronization functions?

I'm having some trouble understanding an example from Klein's serial library for C++. About halfway down this page, there is a section called "Use of Win32 synchronization objects" which I'm having trouble…
Sarkreth
  • 290
  • 2
  • 10