diff --git a/iocp-links.html b/iocp-links.html index da2b8c27..3a6beb82 100644 --- a/iocp-links.html +++ b/iocp-links.html @@ -24,12 +24,12 @@ table th { text-align: left; - padding: 0.5em; + padding: 0.2em; white-space: nowrap; } table td { - padding: 0.5em; + padding: 0.2em; text-align: left; white-space: nowrap; } @@ -120,70 +120,28 @@ Common practice for accessing the disk asynchronously is still done using custom userland thread pools—not POSIX AIO.
Windows IOCPs does support both sockets and regular file I/O which -greatly simplifies the handling of disks. Although the function names are -not exactly the same in Windows for sockets and regular files, the -they act similar. - -
| - | Regular File Read | -Regular File Write | -Socket Read | -Socket Write | -
|---|---|---|---|---|
| Windows | -ReadFile() |
- WriteFile() |
- WSARecv() |
- WSASend() |
-
| POSIX | -read() |
- write() |
- read() or recv() |
- write() or send() |
-
ReadFile() and WSARecv() operate on regular
-files and sockets, respectively. They both are for sending data. Both take a
-OVERLAPPED
-argument.
+greatly simplifies the handling of disks. For example,
+ReadFileEx()
+operates on both.
+As a first example let's look at how ReadFile() works.
typedef void* HANDLE;
-typedef HANDLE SOCKET;
BOOL ReadFile(HANDLE file,
void* buffer,
DWORD numberOfBytesToRead,
DWORD* numberOfBytesRead,
OVERLAPPED* overlapped);
-
-int WSARecv(SOCKET s,
- WSABUF* buffers,
- DWORD bufferCount,
- DWORD* numberOfBytesRecvd,
- DWORD* flags,
- OVERLAPPED* overlapped,
- OVERLAPPED_COMPLETION_ROUTINE completionRoutine);
-For now ignore the completionRoutine parameter in
-WSARecv.
-
-Both functions have the possibility of executing the read synchronously
+The function has the possibility of executing the read synchronously
or asynchronously. A synchronous operation is indicated by
returning 0 and WSAGetLastError()
returning WSA_IO_PENDING.
-
-
-When either function operates asynchronously the
+When ReadFile() operates asynchronously the
the user-supplied OVERLAPPED*
is a handle to the incomplete operation.
@@ -327,13 +285,17 @@ hard limit of 2048 open file descriptors—see
send(2), write(2)WSASend()
+WSASend(),
+WriteFileEx()
recv(2), read(2)WSARecv()
+Windows:
+WSARecv(),
+ReadFileEx()