Overview: network framework
The lowest level network architecture can be found on the iPhone
The SDK is a BSD socket library. Most developers may not need this powerful thing. Many common tasks (sending and receiving data, connecting to the HTTP server, etc.) require a considerable amount of encoding in C if a BSD outlet is used for a straight-up. Apple decided to hide the complexity. By introducing the cfnetwork framework at a higher level. Although we still hold the territory here, rather than the C () in objective-C, it has some obvious advantages, and integration with the running cycle is one of them (which will be discussed in detail later ). As an empirical rule, what "CF" means "core Foundation", starting
The names of objective-C and cocoatouch classes start with "ns" (next step ). Many components are implemented by "CF" and "ns ". Cfreadstream
And Nsinputstream
, Cfnetservice
And Nsnetservice
.Generally, the "ns" version is higher and easier to use, but it often means that the corresponding "CF" version is more flexible and has rich functions.
Original article here
Http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/