{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

overlapped_io_sockets_programming

overlapped_io_sockets_programming - IEG 4180 Network...

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

View Full Document Right Arrow Icon
IEG 4180 IEG 4180 Network Software Design and Programming Network Software Design and Programming Overlapped I/O Overlapped I/O
Background image of page 1

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

View Full Document Right Arrow Icon
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
Background image of page 2
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.
Background image of page 3

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

View Full Document Right Arrow Icon
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
Background image of page 4
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.
Background image of page 5

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

View Full Document Right Arrow Icon
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
Background image of page 6
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
Background image of page 7

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

View Full Document Right Arrow Icon
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
Background image of page 8
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 LPSECURITY_ATTRIBUTES lpSecurityAttributes , // ptr to security descriptor DWORD dwCreationDistribution , // how to create DWORD dwFlagsAndAttributes , // file attributes HANDLE hTemplateFile
Background image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}