Sending a Request
After an RWHttpClient is connected to an HTTP server and an RWHttpRequest object is constructed, your application can submit the request to the client so that it can be sent to the server.
Example 6 – Submitting a request to the client
try {
client.submit(request);
} catch(const RWxmsg& msg) {
// error...
}
The submit method evaluates the request object to ensure that it is complete. If it is, it is sent to the associated HTTP server. Based on the client and request constructed before, the submit method in Example 6 sends the following request to the server:
 
GET / HTTP/1.1
Host: www.perforce.com
The RWHttpAgent class uses member functions in order to submit requests to a server. Because RWHttpAgents are not explicitly connected to any servers, additional information must be passed to the request so that it can determine where the request must be sent. An RWURL object encapsulates the information required by the RWHttpAgent class.
Example 7 – Using RWURL
RWURL url("http://www.perforce.com/");
RWTIOUResult<RWHttpReply> replyIOU = agent.executeGet(url);
All RWHttpAgent execute methods return an RWTIOUResult that contains the response from the server after the request has completed. For more information on the RWTIOUResult class, see the following:
*Multithreading and IOUs of this user’s guide
*’s Guide