You Are Here:

Community: Wiki

This page was last modified on 29 May 2008, at 14:20.

Connecting to http using ghttp lib

From Forum Nokia Wiki

The gHTTP library is designed to be simple and easy to use while still allowing you to get your feet wet at the protocol layer if you have to. You should be able to use the library in your application and never block waiting to send or receive data to/from a remote server

Example

A simple example

/* This is the http request object */
ghttp_request *request = NULL;
 
/* Allocate a new empty request object */
request = ghttp_request_new();
 
/* Set the URI for the request object */
ghttp_set_uri(request, "http://localhost:8080/index.html");
 
/* Close the connection after you are done. */
ghttp_set_header(request, http_hdr_Connection, "close");
 
/* Prepare the connection */
ghttp_prepare(request);
 
/* Process the request */
ghttp_process(request);
 
/* Write out the body.
Note that the body of the request may not be null terminated
so we have to be careful of the length. */

fwrite(ghttp_get_body(request), ghttp_get_body_len(request), 1, stdout);
 
/* Destroy the request.
This closes any file descriptors that may be open and
will free any memory associated with the request. */

ghttp_request_destroy(request);

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTalkE3aE4cargeE5fscreenE5fsaverX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
User Rating: qfnZuserE5FratingQNx2E2E0000X