Questions tagged [overlapped-io]

138 questions
0
votes
1 answer

Why is WriteFile not advancing the file offset for subsequent writes in this code?

I created an overlapped WriteFile scheme, where one thread fills a ring-buffer and advances the head-pointer and calls WriteFile, and another thread watches events from OVERLAPPED writes to advance the tail pointer. The logic is behaving as…
PeterT
  • 920
  • 8
  • 20
0
votes
0 answers

WinAPI. DeviceIoControl - Check overlapped request result

I've got kernel mode driver which handles user-mode requests asynchronously. Maximum number of requests in the queue, lats say, 32. All the following requests are completed with STATUS_INSUFFICIENT_RESOURCE status. I need to check in user-mode app…
rudolfninja
  • 467
  • 7
  • 24
0
votes
0 answers

Why does overlapping I/O become slower on larger files with more I/O operations?

I am trying to understand why this code starts working slower with large 1.8 GB file when parts variable is increasing, so more reads and writes are performed in a single iteration. The function is below. In and out files are created with…
0
votes
0 answers

Winsock2: Effect of send buffer size for overlapped IO

I have been tinkering with an open source project that has started making use of asynchronous overlapped IO for sending data using the Winsock2 interfaces in one of its most recent versions. In the project's past, one approach to improve the send…
Stulle
  • 1
  • 1
0
votes
0 answers

Implented SniStream in c# using openssl in c++ buffer data overlap error

I've implemeneted a stream class which inheretes abstract stream. This class called sniStream which I want to add Sni facility to c#. The source of sniStream is like this, and it uses a native c++ liberary which I've implemented: public class…
Reza Akraminejad
  • 1,412
  • 3
  • 24
  • 38
0
votes
1 answer

Overlapped.AsyncResult doesn't change even after operation completed successfully

To communicate with a HID device, I use some functions from kernel32. Codes are borrowed from Microchip MLA custom HID device project. It uses blocking methods. I found I can make these methods async. Here is what I tried for an async…
AmirSina Mashayekh
  • 498
  • 1
  • 5
  • 21
0
votes
3 answers

WaitCommEvent Fails Invalid Parameter on Second Pass

My application uses serial I/O with overlapped events. For some reason, ::WaitCommEvent fails consistently on the second pass through the loop with ERROR_INVALID_PARAMETER. If anyone can explain what I need to do differently, it would be greatly…
Jim Fell
  • 13,750
  • 36
  • 127
  • 202
0
votes
1 answer

Using the timeout in GetOverlappedResultEx to simulate a wait with timeout?

When using GetOverlapedResult to get the result of an overlapped (i.e. asynchronous) I/O operation, you can ask GetOverlappdResult to "wait": DWORD le = ERROR_SUCCESS; //lastError = 0 if (!ReadFile(FSourceDiskHandle, buffer, BUFFER_SIZE, out…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
0
votes
1 answer

Can too many WSASend in short time be a problem?

I'm making a simple mmorpg server with IOCP. I implemented a simple movement function so I tested with dummy clients(also IOCP). Everything works fine only when few clients are connected. After around 500~1000 clients are connected, some dummy…
Jeongmin Heo
  • 61
  • 1
  • 7
0
votes
2 answers

Asynchronous NtQueryDirectoryFile?

Has anyone managed to figure out how asynchronous calls to NtQueryDirectoryFile work? By an asynchronous call, I mean calling NtQueryDirectoryFile on directories not opened with FILE_SYNCHRONOUS_IO_ALERT or with FILE_SYNCHRONOUS_IO_NONALERT. For me,…
user541686
  • 205,094
  • 128
  • 528
  • 886
0
votes
1 answer

Windows socket completion routine callback after closesocket

While busy working with Windows Sockets in overlapped mode and using Completion routines (so no IOCP) for feedback I found the following curious case: Open a server socket using listen and AcceptEx. Connect a Client socket on said port using…
Ritsaert Hornstra
  • 5,013
  • 1
  • 33
  • 51
0
votes
1 answer

What's the best way to copy a file in a way that I can easily cancel the copy while it is in progress?

I am using ReadFileEx to read some bytes from a file and using WriteFileEx to write some bytes to a device. This action will repeat till all file bytes are read and written to the device. Reason I use Ex APIs is because by requesting overlapped IOs…
ctheadn8954
  • 129
  • 1
  • 8
0
votes
0 answers

(MSDN)Make time-consuming for loop go background (ReadFile, WriteFile, Overlapped structure)

My goal is to read dataBuffer from A and write the data to device B repeatedly using MSDN APIs. I am using ReadFileEx and WriteFileEx to request overlapped I/O reading and writing, so that the original time-consuming for-loop using ReadFile and…
0
votes
2 answers

What is the purpose of WSA_WAIT_EVENT_0 in overlapped IO?

All my experience in networking has been on linux so I'm an absolute beginner at windows networking. This is probably a stupid question but I can't seem to find the answer anywhere. Consider the following code snippet: DWORD Index =…
poby
  • 1,572
  • 15
  • 39
0
votes
1 answer

How do i convert this blocking i/o mode into an overlapped i/o mode in c language on windows?

I am learning to do socket programmming and multithreaded programming in c on windows. I have designed a project where there will be three types of nodes for backup(server, client and storage node). I have created the following to have one server…
John_D
  • 29
  • 6