Book description
If you want to develop network applications for iOS and OS X, this is one of the few books written specifically for those systems. With over 50 recipes and in-depth explanations, it's an essential guide.
In Detail
Darwin, which forms the core set of components for OS X and iOS, is compatible with the Single UNIX Specification Version 3 and POSIX UNIX. Therefore OS X and iOS are UNIX operating systems. While there are numerous books and articles written to teach network development in a UNIX environment there is surprisingly little dedicated to teaching network development specifically in an Apple environment. In this book we will be covering the standard UNIX networking stack with BSD Sockets as well as Apple's frameworks like CFNetworking and Bonjour.
"iOS and OS X Network Programming Cookbook" is an enthralling code-focused book on developing client and server applications for the iOS and OS X environments. You will learn how to integrate a number of Unix (BSD Sockets), Apple specific (CFNetworking, NSMutableURLRequest, Bonjour) and third party APIs (AFNetworking, MKNetworking) with your own apps.
"iOS and OS X Network Programming Cookbook" begins by showing you how to build both client and server applications using the BSD Socket Library as well as Apple's CFNetworking library. The sample code includes samples for both iOS and OS X.
It then covers how to add Bonjour to publish, find, and connect to services. This can be used to create peer-to-peer applications over local networks. Finally it shows how to integrate third-party libraries like Libnet, LibPCAP, AFNetworking, and MKNetworking with the reader's apps.
A lot of developers do not realize that iOS is a full UNIX-based operating system that contains a full set of networking APIs. These APIs can be used to create both client- and server-based applications in the iOS environment as well as OS X. Using the Apple's Bonjour library you will learn how to publish, find, and connect the services together without hardcoding the connection information. There are also a number of third-party APIs that can be used to easily connect iOS and OS X applications to web-based services. Finally this book will cover several low level libraries like LibNET and LibPCAP on the OS X environment.
"iOS and OS X Network Programming Cookbook" will cover several UNIX, Apple, and third-party libraries and APIs. The book will show the user how to integrate all of these libraries and APIs with their applications.
What You Will Learn
- Create client- and server-based applications with the BSD socket API
- Create client- and server-based applications with CFNetworking
- Publish, find, and connect client applications with servers using Apple's Bonjour library
- Use the AFNetworking library to connect to web-based services
- Connect to web-based services using the MKNetworking library
- Explore the LibNET packet construction library in OS X
- Get to grips with the LibPCAP packet capture library in OS X
- Discover Apple's high-level APIs to connect to devices via Bluetooth
- Connect two devices with a Bluetooth connection
Table of contents
-
iOS and OS X Network Programming Cookbook
- Table of Contents
- iOS and OS X Network Programming Cookbook
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. BSD Socket Library
- 2. Apple Low-level Networking
- 3. Using Libnet
-
4. Using Libpcap
- Introduction
- Adding libpcap to your project
- Retrieving network device information
- Capturing packets
- Decoding Ethernet headers
- Decoding IP headers
- Decoding ARP headers
- Decoding TCP headers
- Decoding UDP headers
- Decoding ICMP headers
- Filtering packets
- Saving a capture file
- Creating a simple port scanner using libnet and libpcap together
-
5. Apple High-level Networking
- Introduction
- Performing HTTP(S) synchronous GET requests
- Performing HTTP(S) synchronous POST requests
-
Performing HTTP(S) asynchronous GET requests
- Getting ready
-
How to do it…
- Creating the WebServiceConnectAsynchronous header file
- Creating the sendGetRequest:toURL: method
- Creating the connection:didReceiveResponse: callback method
- Creating the connection:didReceiveData: callback method
- Creating the connection:didFailWithError: callback method
- Creating the connectionDidFinishLoading: callback method
- Creating the connection:willSendRedirect:redirectResponse: callback method
- Creating the connection:willCacheResponse: callback method
- How it works…
- Performing HTTP(S) asynchronous POST requests
-
Parsing an RSS feed with NSXMLParser, NSURL, and NSData
- Getting ready
-
How to do it…
- Creating the RSSItem header file
- Creating the RSSItem implementation file
- Creating the ParseRSS header file
- Creating the initWithUrl: constructor
- Creating the parseXMLFileAtUrl: method
- Creating the parserDidStartDocument: NSXMLParserDelegate method
- Creating the parser:parserErrorOccurred: NSXMLParserDelegate method
- Creating the parser:didStartElement:namespaceURI:qualifiedName:attributes: NSXMLParserDelegate method
- Creating the parser:didEndElement:namespaceURI:qualifiedName: NSXMLParserDelegate method
- Creating the parser:foundCharacters: NSXMLParserDelegate method
- Creating the parserDidEndDocument: NSXMLParserDelegate method
- How it works…
- Creating a peer-to-peer bluetooth network
- 6. Bonjour
- 7. AFNetworking 2.0 Library
- 8. MKNetworkKit
- Index
Product information
- Title: iOS and OS X Network Programming Cookbook
- Author(s):
- Release date: January 2014
- Publisher(s): Packt Publishing
- ISBN: 9781849698085
You might also like
book
Network Programming with Swift: Tools and Techniques to Create iOS and OS X Apps that Network
This is the Rough Cut version of the printed book. Writing networking code has never been …
book
Programming iOS 13
If you’re grounded in the basics of Swift, Xcode, and the Cocoa framework, this book provides …
video
iOS and Mac Network Programming LiveLessons (Video Training)
iOS and Mac Network Programming LiveLessons provides Objective-C developers with a practical introduction to writing high …
video
iOS 13 Programming with Swift 5 - Second Edition
The iOS 13 SDK arrives as a major milestone in the evolution of the Swift language …