overlapped_io_sockets_programming

overlapped_io_sockets_programming - IEG 4180 IEG 4180...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: IEG 4180 IEG 4180 Network Software Design and Programming Network Software Design and Programming Overlapped I/O Overlapped I/O IEG4180: Network Software Design and Programming - Overlapped I/O 2 Copyright Jack Y. B. Lee All Rights Reserved Contents • 1. Introduction • 2. Win32 Overlapped I/O • 3. I/O Multiplexing • 4. Performance Advantages of Overlapped File I/O • 5. Winsock 2 Overlapped I/O • 6. Performance Advantages of Overlapped Socket I/O • 7. Alertable I/O • 8. Case Study: SuperNetProbe IEG4180: Network Software Design and Programming - Overlapped I/O 3 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • What? ¡ A method for performing non-blocking, asynchronous I/O. ¡ Available for File I/O and Socket I/O (Winsock 2). • Mechanism ¡ Issues an I/O call such as ReadFile or WSARecv without needing to wait for it to complete before function return. ¡ Multiple, overlapped I/O calls can be issued. ¡ Program can later check synchronize with the I/O calls. IEG4180: Network Software Design and Programming - Overlapped I/O 4 Copyright Jack Y. B. Lee All Rights Reserved IO proceeds ... 1. Introduction • Comparisons send()/recv() call return Time Time Time Blocking I/O: Non-Blocking I/O: Overlapped I/O: Failed with WSAEWOULDBLOCK Retry Succeeded with IO_PENDING Get I/O Results IO completed IEG4180: Network Software Design and Programming - Overlapped I/O 5 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • Issuing Multiple Overlapping I/O Calls IO #1 proceeds ... 1 Time Application Process: All succeeded with IO_PENDING Get I/O Results 2 3 Time OS Kernel: IO #2 proceeds ... IO #3 proceeds ... Multiple I/O’s can proceed in parallel, i.e., overlapped in time. IEG4180: Network Software Design and Programming - Overlapped I/O 6 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • Windows Platforms ¡ Overlapped File I/O available on Windows NT/2000/XP ¡ Overlapped Winsock I/O available in Winsock 2 • Note it is only emulated in Win95 OSR2 and Win98. • Other Platforms ¡ Unix/Linux Asynchronous I/O (AIO) • Implemented internally using threads in some cases. ¡ Not available in Java IEG4180: Network Software Design and Programming - Overlapped I/O 7 Copyright Jack Y. B. Lee All Rights Reserved Completed? Check for I/O Completion Do something else No Process I/O Yes Open File/Socket Issue I/O Call Close File/Socket 2. Win32 Overlapped I/O • Program Flow IEG4180: Network Software Design and Programming - Overlapped I/O 8 Copyright Jack Y. B. Lee All Rights Reserved ReadFile Completed? Process Read Do something else Check for I/O Completion No Yes CloseHandle CreateFile 2. Win32 Overlapped I/O • APIs for Overlapped File I/O IEG4180: Network Software Design and Programming - Overlapped I/O 9 Copyright Jack Y. B. Lee All Rights Reserved HANDLE CreateFile( LPCTSTR lpFileName , // ptr to name of the file DWORD dwDesiredAccess , // access (read-write) mode DWORD dwShareMode , // share mode...
View Full Document

This note was uploaded on 05/18/2010 for the course INFORMATIO IEG 4180 taught by Professor Jacky.b.lee during the Spring '09 term at CUHK.

Page1 / 51

overlapped_io_sockets_programming - IEG 4180 IEG 4180...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online