$Account.OrganizationName
ACE News and Tips Newsletter Helping You Make the Most of ACE
August 2005

 

Welcome to the August 2005 edition of Riverace's ACE News and Tips newsletter. This issue contains information about our upcoming "How to Use ACE Effectively" training class, a primer on CDR (the data marshal/demarshal facility offered in ACE), and news about what's coming up in the next ACE release.

In this issue
  • Featured Book: C++ Network Programming, Volume 1 (C++NPv1)
  • A Primer on CDR (Common Data Representation) in ACE
  • ACE.next: What's New?

  • A Primer on CDR (Common Data Representation) in ACE

    Many of us have had to write code that uses IPC (perhaps TCP/IP) to transfer data items between processes. When the processes reside on the same system, there are few issues to deal with. However, when transferring data between systems that may have different byte orders, there are suddenly some real issues to tackle. How you decide to handle byte ordering is critical. Which side does what to the data in order to assure that the receiver ends up with the same information that the sender sent?

    If you've programmed much with the Sockets API, you're familiar with the venerable "host-to-net" and "net-to-host" conversion functions. These functions are used to put data into "network byte order." Network order is defined by the TCP/IP suite as "big endian." Sun SPARC is big endian; x86 is little endian. The usual way these functions are used is that the sender converts everything to network byte order and sends it over the network. The receiver(s) convert the received data to their native host byte order and process it. Simple and clean.

    Now, let's throw in another wrinkle. Some hardware architectures have alignment requirements. For example, to access a 4-byte (32-bit) quantity (at least efficiently) on many platforms, the datum must be 4-byte aligned. Other architectures have different, or no, restrictions. So when sending multiple items across a network (say, a variable-length string, a 2-byte integer, and a 8-byte double float) how the items are arranged in the data stream is another level of issue over the byte order. In order for applications written by different organizations to interoperate, systems were invented (such as Sun RPC encoding) to handle this marshaling of data for transmission.

    As network usage has grown over the years, performance has become more and more important. Applications sending lots of network data that's always converting byte order can consume significant amounts of CPU resources. When this ends up being a waste, such as two x86 machines exchanging data with each end swapping bytes, the byte order issue becomes a big target for optimization.

    Common Data Representation (CDR) was introduced in CORBA. CORBA uses CDR to marshal (order, pack, and align) data for transmission. It provides a way to encode binary data for transmission in what's referred to as "receiver makes right" fashion. CDR also defines data packing, padding, and alignment rules for all data sent in CDR form. Because CDR is flexible, portable, and efficient, it's used in many applications outside of CORBA. And since ACE contains a CDR implementation, ACE users can use it as well.

    The "receiver makes right" scheme in CDR works thusly: The sender sends binary data in its native byte order, whatever it is. To allow the receiver(s) to know what byte order the data is using, the sender must somehow inform receivers of the transmission byte order. Usually, this is done by sending a byte order indication byte at the start of a session. When data is received, the receiver is responsible for any byte order conversion that may be needed. That's why it's called "receiver makes right." If there's no need to swap bytes (such as in the case of 2 x86 machines exchanging information in little endian order) then there's no need to use CPU time swapping bytes.

    The data alignment and packing rules in CDR are... well... you don't need to care. It's all taken care of in CDR and, thus, in ACE. That's the beauty of using ACE's CDR facility. The players in a protocol session simply agree (usually by protocol definition) what data will be sent. The packing, ordering, and padding are all taken care of on both the sending and receiving side. C++NPv1 chapter 4 explains how the book's logging client and server applications use CDR to transfer logging records. It's a good starting place for your efforts to design a portable, high-performance, data transmission protocol on your next project. If you would like to discuss how best to use CDR, let us know! We're here to help you make the most of ACE's power and flexibility.


    ACE.next: What's New?

    The ACE development community is hard at work on the next version of ACE. Here are some of the things you can look forward to (items in bold are new or changed since last month):

    • Native library path-searching. Previous ACE versions's implementation of ACE_DLL (used in loading dynamic services) implemented a search of the configured path-search to try and locate the desired library file (DLL) and then used the full pathname to load the library. This skirted some platforms's rules for path search and security settings. This has been changed in the next ACE version to make use of all of the native platform's path-search and security facilities.
    • Improved wide-character support. Wide- character support has been included in ACE for many years on Windows (also known as Unicode builds). However, wide-character support for POSIX platforms has been sorely lacking. As ACE's reach expands, this has become a more important issue. Riverace is leading the completion of wide-character support in the next version of ACE. This support is also available now in the ACE 5.4b fix kit.
    • GNU autotools support. Riverace is the lead developer in charge of adding auto-configure support to ACE. For native-build, non-Windows systems, autoconf will very likely become the way to configure and build ACE. This will help insure that ACE uses the latest features available on each supported platform, and reduce the work required to build ACE. No more picking the right config.h or platform_macros.GNU file. Just do ./configure then make. Ahhh...
    • Support for g++ 4.0, 3.4 and Microsoft Visual C++ 2005 are being added.
    • Support for Red Hat Enterprise Linux 4.
    • Support for Solaris 10.
    • Newer C++ Features Being Used. As the range of ACE-supported compilers matures and older compilers are taken out of service, ACE can make more use of newer C++ features while still maintaining its stellar portability record. For example, many methods that returned 1 or 0 as an int now return bool. Small steps, yes, but significant ones. You'll see more modern C++ usage as time goes on.
    • The ACE and ACE_OS classes, previously containing a number of static member functions, are now C++ namespaces. Similar ACE-internal classes, such as ACE_Sock_Connect, are no longer in use.

    As you can see, the pace of changes is slowing and the ACE development team is beginning to focus more on testing in preparation for the release of ACE 5.5. The current estimate for ACE 5.5's release is late in 2005, so there's time to get a bit more in. In particular, the ACE_Dev_Poll_Reactor implementation for Linux would be a great addition. This was mentioned in our March 2005 newsletter - please check it out using the link below for more information!


    "How to Use ACE Effectively" Training Class: October 17-19, 2005
    We've scheduled an open enrollment "How to Use ACE Effectively" class for October 17-19, 2005 in Waltham, MA (in the Boston area). This is a 3-day class, priced at US$1,250 including continental breakfast, snacks and lunch each day. Each attendee receives a copy of the class slides and a copy of "The ACE Programmer's Guide" (since I'll be teaching the class, I'd also be happy to sign anyone's book).

    Attendees also receive a 10% savings on ACE Annual Support purchased when you pay for your class! Take advantage of this opportunity to make the most of your new ACE knowledge and keep the momentum going back at the office with quick answers and direction on your project's issues!

    For more information and to sign up, see riverace.com


    Featured Book: C++ Network Programming, Volume 1 (C++NPv1)

    C++NPv1 discusses a number of important dimensions to writing high-performance networked applications. In addition to the byte order and alignment issues discussed in this newsletter issue, there are protocol selection issues, IPC factors, and a discussion of how ACE abstracts away error-prone accidental complexities. It's a must-have on your ACE programming bookshelf!

    Buy it now from amazon.com...
    Quick Links...

    ACE Documentation

    Latest ACE 5.3 Fix Kit

    Latest ACE 5.4 Fix Kit

    ACE Training Classes

    ACE Support Services

    Newsletter Archive

    More About Us



    Join our mailing list!
    phone: 888-384-8154