Errata for C++ Network Programming, Volume 1

Last updated February 2, 2007 (at eighth printing).

Page(s)
Description
xxi

Added "Eric Eide," "Alexander Holler", "Craig Perras", "Bruce Trask", "Chris Uzdavinis", "Daire Lynch", and "Chris Smith" to list of contributors.

Put "Luther Baker" and "Darrell Brunsch" in proper alphabetical order.

10
Corrected the for-further-research middleware URL: http://www.dre.vanderbilt.edu.
12
Corrected the ACE download URL: http://download.dre.vanderbilt.edu/.
14
Removed SunOS 4.x, DG/UX, Chorus, pSoS from the supported platforms.
Corrected the ACE Web site URL: http://www.dre.vanderbilt.edu/ACE.
19
Corrected the ACE download URL: http://download.dre.vanderbilt.edu/.
59
Default pathname (index.html) requires a leading '/' to work properly with most HTTP servers.
61

(in uml): ACE_SOCK_IO::recv() has an extra ',' after "ACE_Time_Value *"

(in uml): 4th arg to sendv_n() should be bytes_sent, not bytes_recvd.

62
Changed the phrase "where blocking I/O is the default" to "With blocking I/O, the calling thread waits until the I/O completes."
63

returning "-1" from main() (should match convention on p. 67) need to change
"return peer.close ()"
to
"return peer.close () == -1 ? 1 : 0;"

iov[1].iov_base = pathname caused the compiler to complain since pathname is const char* and iov_base is char*. Fixed by
adding (char *) casts.

3rd paragraph references the client_download_file() which doesn't exist. The fix is to reference main() on this page.

64

TCP_NODELAY in sidebar 6 should be set with peer.set_option(), not with peer.enable().

Sidebar references client_download_file() which doesn't exist. The fix is to reference main() on p. 63.

67

peer->disable () should be peer.disable ().

The comment should be "Ensure blocking <send_n>" *not* "Ensure blocking <recv>s".

auto_ptr <char *> pathname = get_url_pathname (peer)
should be
ACE_Auto_Array_Ptr <char *> pathname (get_url_pathname (peer))

69
Corrected the ACE Web site URL: http://www.dre.vanderbilt.edu/ACE.
75
If ACE::read_n() reports EOF after reading some bytes, the ACE_Message_Block wr_ptr() still needs to be advanced by the number of bytes actually read. Added an explicit nr_recvd argument to read_n() to receive this information.
76
ACE::write_n(head) should be ACE::write_n(ACE_STDOUT,head);
78
Transposed "typed" with "untyped" in 2nd paragraph. Output, not input, cdr classes xform typed data into untyped buffers.
81
Figure 4.4: "acceptor_ ; ACE_SOCK_Acceptor" should be
"acceptor_ : ACE_SOCK_Acceptor". open() and wait() methods are virtual
so should be italicized. w_short in open() should be u_short. In
make_log_file, "s," should be "s :". Arrowheads on dashed lines should be
open. Direction of association from Iterative Logging Server to
Logging_Handler should be reversed, and arrowhead open.
82
s/port/logger_port/ in open() method.
87
Logging_Handler (const ACE_SOCK_Stream&) can't initialize a reference (log_file_) with a 0. This isn't in the ACE_wrappers/examples code so is removed.
88
Example line 27 - need to add ACE_CDR::MAX_ALIGNMENT to be sure the revised size holds the header, payload, and any skipped align bytes. Also, use ACE_CDR::grow() to resize it, not ACE_Message_Block::resize(), in order to maintain CDR alignment.
92
s/port/logger_port/ in open() method.
96
On code line 7, MAXLOGMSGLEN should be ACE_Log_Record::MAXLOGMSGLEN.
127
s/Set a handle to be/Mark a handle as/
144
Correctly check error return from select().
149
Changed "If n is a word, the expression n & ~(n - 1) accesses the least-significant bit (lsb) of n." to "If n is a word, the expression n &~(n - 1) computes a word in which the only set bit is the least-signficant set bit (lssb) of n." Also changed all subsequent occurrences of "lsb" to "lssb".
155
s/port/logger_port/
156
master_handle_set_.set_bit ( .. ) is called twice in handle_connections (). Removed the first call. Added missing call to active_read_handles_.clr_bit in handle_connections().
160
Figure 8.1, the UML relationships are all wrong. There should be a one-to-many aggregation relationship from ACE_Process_Manager to ACE_Process and a dependency relationship from ACE_Process to ACE_Process_Options. There should be no relationship from ACE_Process_Manager to ACE_Process_Options.
163
Figure 8.2, the prepare(), spawn(), unmanage(), parent(), and child() methods are virtual and therefore should be italicized.
165
The code should start the first process off with n-1, not n. Also, when there's no environment variable, start n at 10, not 0.
167
Figure 8.3, setenv() method should be:
+ setenv (format : const char *, ...) : int
170
Figure 8.4, the two wait() methods should be:
+ wait (timeout : const ACE_Time_Value) : int
+ wait (pid : pid_t, timeout : const ACE_Time_Value, status : ACE_exitcode * = 0) : pid_t
172
Changed "where as" to "whereas".
176
In run_worker() method, ACE_static_cast should be ACE_reinterpret_cast.
178

Sidebar 18, item 3. The reference to Logging_Server::prepare() should be to Logging_Process::prepare().

Sidebar 18, item 4. The Logging_Process::prepare() method is on page 181, not page 180.

181
Changed "affect" to "effect".
187
Added a "." after "capabilities" rather than a "," to avoid a comma splice. Also added a "." after "mechanisms"
rather than a "," to avoid a comma splice.
189
Figure 9.1 wait() method should show a second argument,
abandon_detached_threads : int = 0.
191
replace "a ACE_SOCK_Stream" with "an ACE_SOCK_Stream"
193
Figure 9.2 should not have "Logging Acceptor" and "Reactor" boxes; should instead be one "Thread Per Connection Logging Server" box.
194
196
Use auto_ptr<> to manage allocated Thread_Args.
195
Figure in Sidebar 21, should not have spaces in ACE_Thread_Manager::spawn.
196

s/thread it's return/thread its return/

handle_data() parameter name is "client", not "logging_peer".

197

Thread_Per_Connection_Logging_Server reimplements run() to not call handle_data() - it's called in spawned threads.

Code example; call to ACE_Thread_Manager::wait() wants absolute time, not relative.

198
s/newly create thread/newly created thread/
199

in the box next to previous_priority: "If the priority is already the lower priority..." should be "If the priority is already the lowest priority..."

s/key methods outlined/key methods are outlined/

202
s/data is/data are/
210
Figure 10.2, ACE_Read-Guard should be ACE_Read_Guard.
215
Added the missing lines
logging_handler_.close ();
return 0;
to the end of handle_data() and removed a couple of blank lines so the page will still fit!
233
Removed
ACE_thread_t t_id = ACE_OS::thr_self ();
and added
owner_id_ = 0;
Corrected the ACE Web site URL: http://www.dre.vanderbilt.edu/ACE.
248
s/not not/not/
254
The declaration of ACCEPTOR::PEER_ADDR addr does not need "typename" before it because ACCEPTOR is not a template argument.
264
Corrected the TAO Web site URL: http://www.dre.vanderbilt.edu/TAO.
268
Corrected the ACE+TAO build scoreboard web site URL: http://www.dre.vanderbilt.edu/scoreboard/.
287

The title of FJS99a should be "Implementing Application Frameworks: Object-Oriented Frameworks at Work".

The title of FJS99b should be "Building Application Frameworks: Object-Oriented Foundations of Framework Design".