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

//1

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

//2

Prints 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 DocumentContentsNo linkNext 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.
Provide feedback to Rogue Wave about its documentation.