Upload and download files from the Symbian real machine over HTTP

Source: Internet
Author: User

The Symbian real machine has been working on the Symbian HTTP upload and download project for the past 10 days on Eddy, 2007,5, And. It has been around for a long time, we will summarize the problems encountered and solutions for ourselves. briefly introduce the basic knowledge. 1) GRPS access method: cmnet and cmwap are two different APN (Access Point name) of China Mobile GPRS network ). Cmnet provides the NAT service. Mobile phones using this service can directly access the internet. Cmwap only provides WAP proxy and HTTP proxy. The mobile phone can only access IP addresses (10, *) in the GPRS network ,*,*,*). Therefore, cmwap is mainly used for mobile WAP Internet access, while cmnet is used for PCs, laptops, PDAs, and other devices to achieve GPRS internet access. There is no difference between the two mobile Internet access methods. China Mobile's mobile Internet access service targets are different, so their application scope and tariff standards are different. 2) differences between cmnet and cmwap: A: cmwap only opens ports 80, 80, and 9201, which is suitable for HTTP and WAP access (10.0.0.172 was originally used as a gateway for wireless access in the CSD mode, at that time, port 9201 was used, and a dedicated wireless terminal of WAP (Wireless Access Protocal) was used to access the data network. It serves as a gateway between the mobile network and the Internet. It submits the WAP address request of the wireless terminal to DNS resolution and redirects it to the WAP site.
After entering the GPRS era, 10.0.0.172 started to use port 80 as a proxy, still carrying WAP and starting to provide more services, such as MMS and HTTP. Mobile phones are more like Internet address devices using proxy in the LAN) CMNET is suitable for non-http request access like socket. b: CMNET can think of it as a direct connection to the INTERNET on a PC. If you use a CMNET access point, you can directly connect to INTERNETCMWAP, which is equivalent to a LAN on the PC. China Telecom only opens two ports (80 and 9201) for CMWAP. If CMWAP is connected to the INTERNET, the HTTP Proxy Protocol is required. c: Compare the cost. CMWAP requires the internal traffic of the mobile network. The cost can be ignored. CMNET requires China Mobile to pay for the inter-network settlement fee. D: when accessing content, CMWAP can only access the website on the server within the wap network or the software on the wap network where the website providing services is located. For example, OPS xuntong and 10game. You can use CMNET, any service, network, or software. 3) Introduction to WAP (Wireless Application Protocol) Wireless Application Protocol is an open standard Protocol, it uses a markup language (WML) similar to HTML, equivalent to HTML on the Internet (over-file Markup Language), and can directly access a specific Webpage Through the WAP Gateway. WAP can run on various wireless networks, such as GSM, GPRS, and CDMA 1x. The upcoming 3G mobile communication network also supports WAP. In a metaphor, both GPRS and GSM are on the road, while WAP is on the road, and the goods transported on the car are on the WAP website. WAP is only a GPRS application mode, and it has nothing to do with the GRPS access mode. WAP applications are implemented in the "terminal + WAP Gateway + WAP Server" mode. 4) problems encountered during symbian development: first, the symbian string problem: HBufC8 * heapBuf = HBufC8:: NewLC (fileLength); TPtr8 postData8 = heapBuf-> Des (); file. read (postData8); note: this is the key. After a week, you cannot directly generate the file into HBufC8, for example, HBufC8: NewLC (fileStream, fileLength, because HBufC cannot be modified, use Des () to return a modifiable pointer TPtr8, and then read the file. read (TPtr8), symbian does not provide heap descriptor HBuf for modification.  Second, proxy settings. http uses CMWAP on the symbian host. You need to set the http proxy. The proxy IP address is 10.0.0.172 and the port is: 80. After the proxy is set, send a URL Connection, the program code of the get request is as follows: TUriParser8 uri; uri. parse (aUri); TBuf8 <20> aProxy8 (_ L8 ("10.0.0.172: 80"); RStringF iPrxAddr = iSession. stringPool (). openFStringL (aProxy8); CleanupClosePushL (iPrxAddr); THTTPHdrVal iPrxUsage (iSession. stringPool (). stringF (HTTP: EUseProxy, RHTTPSession: GetTable (); iSession. connectionInfo (). setPropertyL (iSession. stringPool (). stringF (HTTP: EProxyUsage, RHTTPSession: GetTable (), iPrxUsage); iSession. connectionInfo (). setPropertyL (iSession. stringPool (). stringF (HTTP: EProxyAddress, RHTTPSession: GetTable (), iPrxAddr); CleanupStack: PopAndDestroy (); RStringF method = iSession. stringPool (). stringF (HTTP: EGET, RHTTPSession: GetTable (); iTransaction = iSession. openTransactionL (uri, * this, method); RHTTPHeaders hdr = iTransaction. request (). getHeaderCollection (); // original error method // _ LIT8 (KHost, "10.0.0.172: 80"); // SetHeaderL (hdr, HTTP: EHost, KHost ); // SetOnLineHostHeader (iPrxAddr); // Add "X_OnLine_Host" SetHeaderL (hdr, HTTP: EUserAgent, KUserAgent); SetHeaderL (hdr, HTTP: EAccept, KAccept); iTransaction. submitL (); the program for setting the http proxy is shown in the basket pen. the http program is finally settled. note: My development environment: symbian 7.0 s + vc ++ 6.0 testing mobile phone: NOKIA6670

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.