The hierarchy of the internet in Objective-C

Maker QR Code in Objective-C The hierarchy of the internet

14.1 The hierarchy of the internet
Encoding Denso QR Bar Code In Objective-C
Using Barcode generation for iPhone Control to generate, create QR Code image in iPhone applications.
www.OnBarcode.com
Paint Barcode In Objective-C
Using Barcode printer for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Internet programming involves a hierarchy of protocols. At the lowest level are the sockets you use to connect one computer to another. Above them are a variety of more sophisticated technologies, such as FTP, Bonjour, and HTTP. HTTP is a critical
GS1 128 Creator In Objective-C
Using Barcode printer for iPhone Control to generate, create GS1-128 image in iPhone applications.
www.OnBarcode.com
Universal Product Code Version A Maker In Objective-C
Using Barcode encoder for iPhone Control to generate, create GS1 - 12 image in iPhone applications.
www.OnBarcode.com
Download from Wow! eBook <www.wowebook.com>
Encoding Barcode In Objective-C
Using Barcode generator for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Code-128 Drawer In Objective-C
Using Barcode drawer for iPhone Control to generate, create Code-128 image in iPhone applications.
www.OnBarcode.com
The web: web views and internet protocols
GTIN - 13 Drawer In Objective-C
Using Barcode maker for iPhone Control to generate, create EAN / UCC - 13 image in iPhone applications.
www.OnBarcode.com
UPC-E Supplement 2 Maker In Objective-C
Using Barcode generation for iPhone Control to generate, create Universal Product Code version E image in iPhone applications.
www.OnBarcode.com
Low-level networking
QR Generator In None
Using Barcode creation for Software Control to generate, create QR Code ISO/IEC18004 image in Software applications.
www.OnBarcode.com
Encoding QR Code 2d Barcode In C#
Using Barcode encoder for .NET framework Control to generate, create QR Code JIS X 0510 image in .NET applications.
www.OnBarcode.com
BSD sockets
Recognize Code 39 Extended In C#
Using Barcode reader for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
USS-128 Encoder In Java
Using Barcode printer for Java Control to generate, create GS1-128 image in Java applications.
www.OnBarcode.com
CFNetworking
QR Printer In Objective-C
Using Barcode creation for iPad Control to generate, create Quick Response Code image in iPad applications.
www.OnBarcode.com
Code128 Printer In .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create Code 128A image in Visual Studio .NET applications.
www.OnBarcode.com
Unabstracted protocols
Read PDF-417 2d Barcode In Visual C#.NET
Using Barcode reader for .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Barcode Reader In Visual C#
Using Barcode Control SDK for .NET framework Control to generate, create, read, scan barcode image in VS .NET applications.
www.OnBarcode.com
Raw HTML access Raw Host Connections
EAN-13 Creator In None
Using Barcode encoder for Online Control to generate, create EAN / UCC - 13 image in Online applications.
www.OnBarcode.com
Data Matrix ECC200 Printer In Objective-C
Using Barcode encoder for iPad Control to generate, create DataMatrix image in iPad applications.
www.OnBarcode.com
CFHost CFHTTPMessage NSData NSURLRequest
QR Code Maker In None
Using Barcode encoder for Microsoft Excel Control to generate, create QR Code JIS X 0510 image in Office Excel applications.
www.OnBarcode.com
Read UPC A In VB.NET
Using Barcode decoder for .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Web views
Abstracted HTML display
UIWebView
Web protocols
Social networking, Ajax, JSON, RSS, SOAP, XML
NSXMLParser Third-Party libraries
Internet protocols are arranged in a hierarchy.
protocol, represented on the iPhone and iPad by both low-level access and the highlevel UIWebView. Recently, an increasing number of protocols have been built on top of HTTP, forming what we call the social web. This hierarchy of internet protocols is shown in figure 14.1, along with iPhone OS classes of note. In this chapter, we ll cover all these protocols, starting with the lowest level. But our real focus will be on the higher-level internet and social web protocols, because they re the protocols that are best supported by the iPhone OS, and they re the ones you re most likely to want to interact with.
14.2 Low-level networking
We ve opted not to pay much attention to BSD sockets and the lower-level networking classes, because we expect they ll be of little interest to most application programmers. If you need to work with BSD sockets, you should look at Apple s Introduction to CFNetwork Programming Guide. If you need to work with the lower-level protocols, CFNetwork provides a variety of classes that you ll find useful. You can find more information about them in the Networking & Internet topic in the Apple docs. In particular, the CFNetwork Framework Reference will give you an overview of the various classes. Among the classes are CFFTPStream, which lets you communicate with FTP servers; and CFNetServices, which gives you access to Bonjour Apple s service discovery protocol. There are also two low-level HTTP-related classes, CFHTTPMessage and CFHTTPStream. We ll leave these classes alone, because our HTML work will be related to the higher-level NSURL, NSURLRequest, UIWebView, NSMutableURLRequest, and NSURLConnection classes.
Download from Wow! eBook <www.wowebook.com>
Low-level networking
Rather than skipping over these low-level and unabstracted protocols entirely, we ll look at one of them: CFHost. It s the easiest to work with and perhaps the most immediately useful.
14.2.1 The CFHost class
CFHost allows your program to request information about an internet host, such as its
name, its address, and whether it s reachable. Listing 14.1 shows a sample of how to determine whether a hostname exists.
Listing 14.1 A simple hostname lookup
-(IBAction)reportStatus:(id)sender { CFStreamError errorTest; if (myInput.text) { CFHostRef myHost = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)myInput.text); if (myHost) { if (CFHostStartInfoResolution(myHost, kCFHostAddresses, &errorTest)) { myOutput.text = [myInput.text stringByAppendingString: @" COULD be resolved."]; } else { myOutput.text = [myInput.text stringByAppendingFormat: @" could NOT be resolved (Error: %i).", errorTest.error]; } } CFRelease(myHost); } }
The sample method, reportStatus:, is activated by a button push. It reads a hostname from a UITextField called myInput and reports out to a UITextView called myOutput. All uses of the CFHost commands follow the same pattern. First you create a CFHostRef object with CFHostCreateCopy, CFHostCreateWithAddress, or CFHostCreateWithName. Then, you use CFHostStartInfoResolution to request a certain type of information, which can be kCFHostAddresses, kCFHostNames, or kCFHostReachability. This example omits a final step in which you retrieve the information with CFHostGetAddressing, CFHostGetNames, or CFHostReachability something that isn t necessary here because the point is to see if the request for an address resolves correctly. You can find more information about these functions, and about how to use a callback function to make the host resolution asynchronous, in the CFHost reference. We consider this look at low-level networking and CFHost an aside, meant only to hint at what s possible if you must do lower-level networking work. Now, we ll move on to higher-level HTML-related network work that s more likely to be the focus of your network programming. The first thing you ll need to know is how to use the iPhone OS s URL objects.
Copyright © OnBarcode.com . All rights reserved.