Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Networking Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

6.2 Controlling Network Access

The socket address classes use the virtual function RWSockAddrBase::prepare() to access the network. This function enables you to explicitly control when use of an address object might cause the thread of control to block. By calling prepare() right after an address is constructed, you guarantee that any future use of that address will not cause your application to block.

The code shown below retrieves the host name associated with an Internet address.

The call in line //1 may require a network access to look up the name. This can cause the thread of control to block while the network access occurs.

To avoid a block, you can write the code like this:

The code on line //2 no longer uses the network and will not block because the call to prepare() on line //1 has already retrieved the information for that address.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.