IO Completion Ports and socket WSARecv()

user4582812

I am trying to understand how IOCP works with sockets. I need to understand if this is how they work:

I create a completion port, which is nothing but a queue that will receive notifications when some operation completes, and then I associate my socket with it, and then I process incoming notifications.

Now I want to know how this relates to receiving of data from a socket, so when I call WSARecv() what exactly happens, does WSARecv() returns immediately when I call it (does not block) and then later on when data arrives to WSARecv() I get a notification that data were received?

John

Yes, this is what happens.

When you call WSARecv(), the function will return immediately (note that you must pass it a buffer to store the received data). Now the system will read the data received from the other end and store it in the supplied buffer. When the system does that, it will place a notification in the completion port to inform you that the read operation has been completed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

WSARecv sometimes return "invalid handle (error no 6)" for a socket associated with an IOCP port. (C++)

From Dev

Sailsjs Socket IO

From Dev

IO Completion Ports (IOCP)

From Dev

Asynchronous action methods and IO completion ports

From Dev

Multiple I/O Completion Ports

From Dev

JavaScriptCore + Socket.IO

From Dev

Socket.io alternative

From Dev

select() equivalence in I/O Completion Ports

From Dev

Socket io get is undefined

From Dev

IO Completion port Linux equivalent

From Dev

Routing with socket.io

From Dev

IO Completion Ports and socket send()

From Dev

Does all error codes of WSASend() and WSARecv() means that the socket has disconnected?

From Dev

"Un-associate" socket from completion port

From Dev

React and Socket.io

From Dev

AJAX or socket.io?

From Dev

Socket ports are not matching listening ports

From Dev

Business logic in IO completion Port

From Dev

CloudFlare and socket.io

From Dev

Socket.io client requests fail when frontend and backend run on different ports

From Dev

IO Completion Ports and OVERLAPPED management

From Dev

io completion ports issue with calling multiple wsarecv or wsasend per GetQueuedCompletionStatus

From Dev

IO Completion port Linux equivalent

From Dev

IO Completion Ports and socket send()

From Dev

IO Completion Ports and socket WSARecv()

From Dev

How to know when the socket has received a FIN packet when using WSARecv() and IOCP?

From Dev

How to reregister for IO Completion ports for a handle

From Dev

AVR IO Ports can not be global

From Dev

Windows socket completion routine callback after closesocket