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

4.4 Reading From a Portal

Example 3 expands on Example 2 by printing the first packet of output returned by the socket.

Example 3: Reading from a portal

//1Gets the next packet of information that arrives at the socket. Applications cannot predict how much data will be returned in the string.
//2Prints the data that arrived.

This example does not always handle all data sent by the server. More data could arrive after the first packet is printed. To handle more data, replace line //1 with this loop:

This loop enables the code to receive data on the portal until the recv() function returns the null string, which happens when the server terminates the connection.

See the wwwget sample program for an example of how to use the RWSocketPortal class. It uses code similar to this example to fetch a page of the World Wide Web using the HTTP protocol.



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.