Solved

What is Winsock Overlapped I/O?

Posted on 2009-03-29
6
982 Views
Last Modified: 2013-11-13
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
Comment
Question by:nanderEire
  • 2
  • 2
  • 2
6 Comments
 
LVL 10

Accepted Solution

by:
Marcjev earned 125 total points
ID: 24014711
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
 
LVL 10

Expert Comment

by:Marcjev
ID: 24014717
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
 

Author Comment

by:nanderEire
ID: 24016611
Great.

So what is the difference between the operation of an i/o overlapped and a socket placed in non-blocking mode?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Assisted Solution

by:migoEX
migoEX earned 125 total points
ID: 24016755
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
 

Author Comment

by:nanderEire
ID: 24016929
So you can just keep queueing up the sends without checking the return value to see if each was successful?
0
 
LVL 5

Expert Comment

by:migoEX
ID: 24017355
Yes. I assume there's some limit, of cause, but in theory you can sedn many requests whithout waiting for any to complete.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 125
WPF issue with Trigger 2 115
Unable to start eclipse ? 17 154
numbers ascending pyramid 101 213
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question