CSE 532S Proactive Event Handling Studio

These exercises are designed to offer additional practice working with event handling in ACE (i.e., a proactive version of your previous client and server programs), and optionally to explore reimplementation using Boost.Asio based code.

Please record your answers in a file, and upon completion please email your answers to the cse532@seas.wustl.edu course account with subject line Proactive Event Handling studio.

Please make sure that the name of each person who worked on these exercises is listed, and that you number your answers so they are easy for us to match up with the appropriate exercise.

Visual Studio 2013 is not successfully compiling ACE on the Windows machines in Urbauer 218, so you should please use Visual Studio 2012 for this studio (and for subsequent studios and for the lab 3 assignment).


    Required Exercises

  1. As the answer to the first exercise, please list the names of all the people who worked on this studio.

  2. Refactor your client code from the Acceptor and Connector studio exercises so that it uses proactive event handling, including a proactor for event demultiplexing, asynchronous connection establishment, and asynchronous service handling.

    For example, you may need to replace your uses of the ACE_Connector, ACE_Sock_Stream, ACE_Reactor, and ACE_Svc_Handler classes with ACE_Asynch_Connector, ACE_Asynch_Write_Stream, ACE_Proactor, and ACE_Service_Handler instead. As the answer to this exercise, please show your updated code.

  3. Build and run your (now proactive) client code on the windows machine, with your (still reactive) server. Confirm that your client and server still perform the same basic functionality as they did before that refactoring (or fix any problems until they do). As the answer to this exercise, please describe what changes were needed to refactor your client to use proactive event handling.

  4. Refactor your server code from the Acceptor and Connector studio exercises so that it uses proactive event handling, including a proactor for event demultiplexing, asynchronous connection establishment, and asynchronous service handling.

    For example, you may need to replace your uses of the ACE_Acceptor, ACE_Sock_Stream, ACE_Reactor, and ACE_Svc_Handler classes with ACE_Asynch_Acceptor, ACE_Asynch_Read_Stream, ACE_Proactor, and ACE_Service_Handler instead. As the answer to this exercise, please show your updated code.

  5. Build and run your (now proactive) server code on the windows machine, with your (now proactive) client also running on a Windows machine. Confirm that your client and server still perform the same basic functionality as they did before that refactoring (or fix any problems until they do). As the answer to this exercise, please describe what changes were needed to refactor your server to use proactive event handling.

  6. Test the other features of the client and server, including signal handling for Ctrl-C. If you run into features that do not work, feel free either to fix them or to simply note the breakage. As the answer to this exercise, please document what did and did not work, and for any that that did not work explain briefly the nature (and optionally the cause and/or resolution) of the problem.

    Enrichment Exercises (Optional)

  7. Download a zip file for the boost library at http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.zip/download and unzip it into a location where you can use it on the Windows lab machines for your studios and projects for the rest of this semester (e.g., within the Projects folder under Visual Studio 2012 if you are keeping your other projects there).

    Open up a terminal window and at the command prompt change your current directory to the Boost root directory, run the bootstrap.bat batch file (which builds the Boost.Build engine) and then run b2 which actually builds boost, as in:

    C:\>H:

    and then

    H:\>cd "My Documents\Visual Studio 2012\Projects\boost_1_54_0"

    and then

    H:\My Documents\Visual Studio 2012\Projects\boost_1_54_0>bootstrap

    and then

    H:\My Documents\Visual Studio 2012\Projects\boost_1_54_0>.\b2

    Additional documentation for boost can be found via various links from the main boost web page at http://www.boost.org/, the Boost.Asio web page at http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio.html, and the boost Getting Started on Windows page at http://www.boost.org/doc/libs/1_54_0/more/getting_started/windows.html. Once you have successfully installed boost, as the answer to this exercise please give the fully qualified path to the directory in which you installed it.

  8. Create two new projects in Visual Studio 2012 for this studio, for a simple client program and a simple server program written using boost asio (e.g., named something like BoostAsynchClient and BoostAsynchServer. After you create each project, open up its project properties dialog window, and under Congfiguration Properties -> C/C++ -> General -> Additional Include Directories please give the fully qualified path to the boost_1_54_0 directory.

    In those projects, reimplement your client and server files files (respectively) from the required exercises for this studio, using boost.asio (instead of ACE) asynchronous library features, such as the io_service, ip::tcp::socket, ip::tcp::endpoint, ip::tcp::acceptor, and streambuf types and possibly a function or two (such as async_connect etc.) which are found in the boost::asio namespace.

    Save your code files and build your programs, and as need under Congfiguration Properties -> Linker -> General -> Additional Library Directories please give the fully qualified path directory to the directory (or directories) where the boost build placed its .lib files, and under Congfiguration Properties -> Linker -> Input -> Additional Dependencies please add the names of any .lib files your programs require.

    Run each of your Boost.Asio based programs with each other, and with their ACE counterparts. Fix any errors or warnings that may occur, and as the answer to this exercise, please describe what happened in each of those cases.