Dr. Dobb's Journal - November 2008 - (Page 34) Client Server SYN SYN gtRECO . . . gtWSLE FIN LEADTOOLS v.16 - C DLL, C++, .NET, WPF, ActiveX, COM, and more! Develop your application with the same time-tested & robust imaging code used by Fortune 1000 companies such as Microsoft, HP, Kodak, GE, Ford and CitiCorp. LEADTOOLS provides developers easy access to decades of expertise in developing color, grayscale, document, medical, vector & multimedia imaging code. Install LEADTOOLS to eliminate months of research and development time while maintaining high levels of quality, performance and functionality. S l e e p WPF (XAML) controls: Viewer, Image List and more AJAX Web Form Image controls JPIP Client & Server Image formats: 150+ including TIFF, JPEG, JPEG XR, JPEG2000, PDF, XPS, DWG Display controls: scroll, zoom, pan, brightness, window level WIA scanning: supports 32 & 64 bit drivers TWAIN scanning: auto-detect optimum driver settings for fastest scanning Image processing: 200+ filters, transforms & color conversion functions Document cleanup/preprocessing: deskew, despeckle, registration & more OCR / ICR / OMR: Full Page or Zonal recognition with formatted output including PDF, DOC & TXT Barcode: Detect, read & write 1D & 2D symbols including DataBar, EAN, DataMatrix, QR, PDF417 Forms Recognition & Processing Bitonal compression: JBIG, JBIG2, ABIC, CCITT G4 & more Annotations: Interactive UI for image mark-up including shapes, text, measurement, security & multimedia Grayscale imaging: display & process signed/unsigned 12-16 bit, 32 bit data Medical Web Viewer Framework DICOM: All IOD classes & modalities (CR, CT, MR, NM, US, RF, SC, VL & more) DICOM Communications: high/low-level functions for all service classes Multimedia: capture, play, stream & convert DVD, MPEG, AVI, WMV, MP4, MP3, OGG, ISO & more PDF & PDF/A: read/write raster and text searchable PDF files. DVD: creation & burn SYN SYN gtWWAK gtRECO Lost data synchronization Data queued while sleeping . . . sleep/wake cycle, and spawns two processes—one to send data to the client and one to receive data from the client. The send and receive data processes execute in parallel, writing to and reading from the client independently. When the client transitions to a sleep state, the send and receive data processes cease executing and the reconnect process waits for the client to wake up and connect again. Because the server application itself never writes or reads directly to a socket, the sleep/awake transitions occur transparently, uncoupling the state of the application from the state of the connection. The recv-dataA() Function When the reconnect process detects that the client has reestablished a connection, it spawns a process to receive the data from this connection. This new process calls the recv_data() function in Listing One. This function handles reading data from the network connection to the client and places it in an intermediate queue from which the gtelnet application reads. In this way, we have abstracted the underlying network connection uncoupling the state of the TCP connection from the state of the gtelnet daemon. The recv_data() function receives three variables as parameters. It requires the socket that the client is connected with (s_client), a FIFO buffer to write data that is read from the client (recv_data_fd), and the PID of the send data process to notify when the client goes to sleep (send_data_pid). Lines 13 through 15 read data from the client socket, s_client, and write the read data to recv_data_fd, which is the FIFO buffer that the server application reads data from. When the client is asleep and recv_data() is not invoked, the recv_data_fd has no new data placed into it, which appears as an idle Figure 1: Power state change notification. the data is not immediately sent to the client. Instead, we place the data in an intermediate queue and wait until the client reconnects. When the client transitions to a fully awake state and reestablishes a connection to the server (to its previously determined reconnect port), the server flushes any queued data back out to the client. The reconnect, send data, and receive data processes compose the wedge we placed between the server application and the network connection. Figure 3 is an application-level block diagram of the reconnect process and its interactions with the send data and receive data processes. When the client is asleep, the reconnect process waits for a new connection from the client. When the client opens a new connection, we transition to “client is awake” state. The reconnect process accepts the new connection, sends the port number that the client should reconnect to for the next MAC IP TCP gt payload CRC (866) 530-3418 Free 60 Day Eval! www.leadtools.com/dobbs LEADTOOLS SDKs feature LEAD’s iCompress™ Technologies. 34 gt flags = WWAK for want wake-up WSLE for want sleep RECO for reconnect payload = gt command parameter if WWAK, WSLE, or RECO; otherwise, contains telnet data Figure 2: gtelnet packet showing new gt field. Dr. Dobb’s Journal l www.ddj.com l November 2008 http://www.leadtools.com/dobbs http://www.leadtools.com/dobbs http://www.ddj.com
Table of Contents Feed for the Digital Edition of Dr. Dobb's Journal - November 2008 Dr. Dobb's Journal - November 2008 Contents Friday Night Fish Fry Alia Vox Developer Diaries Developer's Notebook Saving Open Source Conversations iPhone Building Your Own Web Server Green Telnet What's New In Boost Threads? Testing Service Oriented Architectures Test Case Generation, UML, and Eclipse Unit Testing Web Services C3 Programming The Agile Edge Swaine's Flames Effective Concurrency Dr. Dobb's Journal - November 2008 Dr. Dobb's Journal - November 2008 - (Page BB1) Dr. Dobb's Journal - November 2008 - (Page BB2) Dr. Dobb's Journal - November 2008 - Dr. Dobb's Journal - November 2008 (Page Cover1) Dr. Dobb's Journal - November 2008 - Dr. Dobb's Journal - November 2008 (Page Cover2) Dr. Dobb's Journal - November 2008 - Dr. Dobb's Journal - November 2008 (Page 1) Dr. Dobb's Journal - November 2008 - Dr. Dobb's Journal - November 2008 (Page 2) Dr. Dobb's Journal - November 2008 - Dr. Dobb's Journal - November 2008 (Page 3) Dr. Dobb's Journal - November 2008 - Contents (Page 4) Dr. Dobb's Journal - November 2008 - Contents (Page 5) Dr. Dobb's Journal - November 2008 - Friday Night Fish Fry (Page 6) Dr. Dobb's Journal - November 2008 - Friday Night Fish Fry (Page 7) Dr. Dobb's Journal - November 2008 - Friday Night Fish Fry (Page 8) Dr. Dobb's Journal - November 2008 - Friday Night Fish Fry (Page 9) Dr. Dobb's Journal - November 2008 - Alia Vox (Page 10) Dr. Dobb's Journal - November 2008 - Alia Vox (Page 11) Dr. Dobb's Journal - November 2008 - Developer Diaries (Page 12) Dr. Dobb's Journal - November 2008 - Developer Diaries (Page 13) Dr. Dobb's Journal - November 2008 - Developer's Notebook (Page 14) Dr. Dobb's Journal - November 2008 - Developer's Notebook (Page 15) Dr. Dobb's Journal - November 2008 - Saving Open Source (Page 16) Dr. Dobb's Journal - November 2008 - Saving Open Source (Page 17) Dr. Dobb's Journal - November 2008 - Saving Open Source (Page 18) Dr. Dobb's Journal - November 2008 - Saving Open Source (Page 19) Dr. Dobb's Journal - November 2008 - Conversations (Page 20) Dr. Dobb's Journal - November 2008 - Conversations (Page 21) Dr. Dobb's Journal - November 2008 - iPhone (Page 22) Dr. Dobb's Journal - November 2008 - iPhone (Page 23) Dr. Dobb's Journal - November 2008 - iPhone (Page 24) Dr. Dobb's Journal - November 2008 - iPhone (Page 25) Dr. Dobb's Journal - November 2008 - iPhone (Page 26) Dr. Dobb's Journal - November 2008 - iPhone (Page 27) Dr. Dobb's Journal - November 2008 - Building Your Own Web Server (Page 28) Dr. Dobb's Journal - November 2008 - Building Your Own Web Server (Page 29) Dr. Dobb's Journal - November 2008 - Building Your Own Web Server (Page 30) Dr. Dobb's Journal - November 2008 - Building Your Own Web Server (Page 31) Dr. Dobb's Journal - November 2008 - Building Your Own Web Server (Page 32) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 33) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 34) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 35) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 36) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 37) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 38) Dr. Dobb's Journal - November 2008 - Green Telnet (Page 39) Dr. Dobb's Journal - November 2008 - What's New In Boost Threads? (Page 40) Dr. Dobb's Journal - November 2008 - What's New In Boost Threads? (Page 41) Dr. Dobb's Journal - November 2008 - What's New In Boost Threads? (Page 42) Dr. Dobb's Journal - November 2008 - What's New In Boost Threads? (Page 43) Dr. Dobb's Journal - November 2008 - What's New In Boost Threads? (Page 44) Dr. Dobb's Journal - November 2008 - What's New In Boost Threads? (Page 45) Dr. Dobb's Journal - November 2008 - Testing Service Oriented Architectures (Page 46) Dr. Dobb's Journal - November 2008 - Testing Service Oriented Architectures (Page 47) Dr. Dobb's Journal - November 2008 - Testing Service Oriented Architectures (Page 48) Dr. Dobb's Journal - November 2008 - Test Case Generation, UML, and Eclipse (Page 49) Dr. Dobb's Journal - November 2008 - Test Case Generation, UML, and Eclipse (Page 50) Dr. Dobb's Journal - November 2008 - Test Case Generation, UML, and Eclipse (Page 51) Dr. Dobb's Journal - November 2008 - Test Case Generation, UML, and Eclipse (Page 52) Dr. Dobb's Journal - November 2008 - Unit Testing Web Services (Page 53) Dr. Dobb's Journal - November 2008 - Unit Testing Web Services (Page 54) Dr. Dobb's Journal - November 2008 - Unit Testing Web Services (Page 55) Dr. Dobb's Journal - November 2008 - Unit Testing Web Services (Page 56) Dr. Dobb's Journal - November 2008 - Unit Testing Web Services (Page 57) Dr. Dobb's Journal - November 2008 - Unit Testing Web Services (Page 58) Dr. Dobb's Journal - November 2008 - C3 Programming (Page 59) Dr. Dobb's Journal - November 2008 - C3 Programming (Page 60) Dr. Dobb's Journal - November 2008 - C3 Programming (Page 61) Dr. Dobb's Journal - November 2008 - C3 Programming (Page 62) Dr. Dobb's Journal - November 2008 - C3 Programming (Page 63) Dr. Dobb's Journal - November 2008 - The Agile Edge (Page 64) Dr. Dobb's Journal - November 2008 - The Agile Edge (Page 65) Dr. Dobb's Journal - November 2008 - The Agile Edge (Page 66) Dr. Dobb's Journal - November 2008 - The Agile Edge (Page 67) Dr. Dobb's Journal - November 2008 - Effective Concurrency (Page 68) Dr. Dobb's Journal - November 2008 - Effective Concurrency (Page 69) Dr. Dobb's Journal - November 2008 - Effective Concurrency (Page 70) Dr. Dobb's Journal - November 2008 - Effective Concurrency (Page 71) Dr. Dobb's Journal - November 2008 - Swaine's Flames (Page 72) Dr. Dobb's Journal - November 2008 - Swaine's Flames (Page Cover3) Dr. Dobb's Journal - November 2008 - Swaine's Flames (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.