message_driven_sockets_programming

message_driven_sockets_programming - IEG 4180 Network...

Info iconThis preview shows pages 1–8. 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 Message Message -Driven Sockets Programming Driven Sockets Programming
Background image of page 1

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

View Full DocumentRight Arrow Icon
IEG4180: Network Software Design and Programming - Message-Driven Sockets Programming 2 Copyright Jack Y. B. Lee All Rights Reserved Contents • 1. Introduction • 2. Elements of a Windows Program • 3. Building Windows Programs • 4. Blocking I/O Under Windows • 5. Message-Driven Winsock I/O • 6. Direct Programming • 7. Piggybacking on a Dialog Window Procedure • 8. Algorithms for Message-Driven Socket I/O • 9. Producer-Consumer Architecture • 10. Common Traps and Pitfalls • 11. Case Study: NetProbe GUI Version
Background image of page 2
IEG4180: Network Software Design and Programming - Message-Driven Sockets Programming 3 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • Windows Message Passing Architecture ± Windows Message Types • Hardware messages (mouse move, mouse click, keyboard, etc.) • Software messages (repaint, timer, etc.) • Application messages defined by programmers ± Application Messages Routing Process A Process B Process C Windows Kernel Mouse Keyboard
Background image of page 3

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

View Full DocumentRight Arrow Icon
IEG4180: Network Software Design and Programming - Message-Driven Sockets Programming 4 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • Program Flow ± DOS/Unix/Windows Console programs: • Synchronous Execution: int main ( ) function_A1( ) function_A2( ) function_A2i( ) function_A( ) function_X( ) function_X1( ) function_X2( ) . . . Operating System
Background image of page 4
IEG4180: Network Software Design and Programming - Message-Driven Sockets Programming 5 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • Program Flow ± Windows Programs with GUI: • Message-driven Execution (Asynchronous): WinMain ( ) while( GetMessage { TranslateMessage( &msg ); DispatchMessage ( &msg ); } Operating System Process Message Queue: WindowProcX() WindowProcY() WindowProcZ() . . . Message Dispatching Module
Background image of page 5

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

View Full DocumentRight Arrow Icon
IEG4180: Network Software Design and Programming - Message-Driven Sockets Programming 6 Copyright Jack Y. B. Lee All Rights Reserved 1. Introduction • Message Dispatching ± Every GUI element has a data structure – called the Windows element , to maintain its states. ± Every Window element has an associated Window Procedure - registered when the Window is created, for processing messages. LRESULT WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam ) { switch (iMessage) { case WM_CREATE: DoCreate(); break; case WM_PAINT: Paint(); break; case WM_DESTROY: PostQuitMessage( 0 ); break; default: return DefWindowProc( hWnd, iMessage, wParam, lParam ); } return 0; }
Background image of page 6
IEG4180: Network Software Design and Programming - Message-Driven Sockets Programming 7 Copyright Jack Y. B. Lee All Rights Reserved 2. Blocking I/O Revisited • Can we still use blocking I/O under Windows? ± Yes, of course.
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the 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 / 31

message_driven_sockets_programming - IEG 4180 Network...

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

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