• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1074
  • Last Modified:

What is Winsock Overlapped I/O?

Hi,

What is Overlapped I/O as available for sockets in Winsock?

How does it work and why is it more efficient than other i/o models?
0
nanderEire
Asked:
nanderEire
  • 2
  • 2
  • 2
2 Solutions
 
MarcjevCommented:
You should see overlapped I/O as a kind of assynchronious IO. In your program you start a function call and it returns immediatly.
So WSASend en WSAReceive will return immediatly. You will be able to receive and event when the opperation is complete.
As you can do other things in the time the system is normally in the blocking call, you cal do more efficient programming, like handling the data received in a previous opperation.
But although it has to potential to be more efficient, it's up to you, the programmer, to actually achieve the gain, by programming a more complex program.
0
 
MarcjevCommented:
Also, when handling multiple connections, you could handle more connections as they are non blocking. So you could use the cpu more effectively. If you have a one to one connection the gain is not as much as having a many to one connection.
0
 
nanderEireAuthor Commented:
Great.

So what is the difference between the operation of an i/o overlapped and a socket placed in non-blocking mode?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
migoEXCommented:
With non-blocking socket your "send/recv" will fail with WOULD_BLOCK error code, and you'll have to retry the operation later (probably using some sort of "select"). Buth the asynchronous function continues in the background, and you can later get a notification that it has completed/failed (in form of Event or callback).
0
 
nanderEireAuthor Commented:
So you can just keep queueing up the sends without checking the return value to see if each was successful?
0
 
migoEXCommented:
Yes. I assume there's some limit, of cause, but in theory you can sedn many requests whithout waiting for any to complete.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now