Introduction to CFNetwork Programming Guide(译)

来源:互联网 发布:淘宝都是天猫 编辑:程序博客网 时间:2024/04/30 05:02

CFNetwork编程指南介绍

@官方文档翻译-李冰

@译文

CFNetwork提供了网络协议抽象库的最为核心的服务框架。这些抽象使得它更容易执行各种网络任务,比如:

  • 与BSD套接字的工作
  • 用SSL或者TLS建立加密连接
  • 解析DNS主机
  • 使用HTTP协议,HTTP和HTTP协议的服务器认证
  • 使用FTP服务器
  • 发行,解决和浏览Bonjour服务(在NSNetServices和CFNetServices编程指南中描述)

这本书为想要在自己的应用程序中使用网络协议的开发者准备的。为了更全面的了解这本书,读者需要对网络编程概念有一个很好的理解比如BSD套接字,流和HTTP协议。此外,读者需要熟悉OS X编程概念包括run loops。更多关于OS X的信息请阅读Mac Technology Overview。

文档结构

这本书包括以下章节:
- CFNetwork ConceptsCFNetwork(一) 描述CFNetwork的每个API以及它们如何相互作用。
- Working with Streams-CFNetwork(二) 怎样使用CFStream的API取发送和接收网络数据。
- Communicating with HTTP Servers-CFNetwork(三) 描述怎样发送和接收HTTP消息。
- Communicating with Authenticating HTTP ServersCFNetwork(四) 描述怎样与安全的HTTP服务器通信。
- Working with FTP ServersCFNetwork(五) 描述怎样从FTP服务器去上传和下载文件,以及怎样去下载文件列表。
- Using Network DiagnosticsCFNetwork(六) 描述怎样去添加网络诊断到你的应用程序。

参见

更多的关于OS X的网络APIs,可阅读:
- Getting Started With Networking

CFNetwork参阅下面的参考文档:

  • CFFTPStream Reference 是CFFTPStream的API参考文档

  • CFHTTPMessage Reference 是CFHTTPMessage的API参考文档

  • CFHTTPStream Reference 是CFHTTPStream的API参考文档

  • CFHTTPAuthentication Reference 是CFHTTPAuthentication 的API参考文档

  • CFHost Reference 是CFHost的API参考文档

  • CFNetService Reference 是CFNetServices的API参考文档

  • CFNetDiagnostics Reference 是CFNetDiagnostics的API参考文档

除了苹果提供的文档外,下面是socket级别编程的参考书:

  • UNIX Network Programming, Volume 1 (Stevens, Fenner and Rudoff)

官方文档

CFNetwork is a framework in the Core Services framework that provides a library of abstractions for network protocols. These abstractions make it easy to perform a variety of network tasks, such as:

  • Working with BSD sockets
  • Creating encrypted connections using SSL or TLS
  • Resolving DNS hosts
  • Working with HTTP, authenticating HTTP and HTTPS servers
  • Working with FTP servers
  • Publishing, resolving and browsing Bonjour services (described in NSNetServices and CFNetServices Programming Guide)

This book is intended for developers who want to use network protocols in their applications. In order to fully understand this book, the reader should have a good understanding of network programming concepts such as BSD sockets, streams and HTTP protocols. Additionally, the reader should be familiar OS X programming concepts including run loops. For more information about OS X please read Mac Technology Overview.

Organization of This Document

This book contains the following chapters:

  • CFNetwork Concepts describes each of the CFNetwork APIs and how they interact.
  • Working with Streams describes how to use the CFStream API to send and receive network data.
  • Communicating with HTTP Servers describes how to send and receive HTTP messages.
  • Communicating with Authenticating HTTP Servers describes how to communicate with secure HTTP servers.
  • Working with FTP Servers describes how to upload and download files from an FTP server, and how to download directory listings.
  • Using Network Diagnostics describes how to add network diagnostics to your application.

See Also

For more information about the networking APIs in OS X, read:

  • Getting Started With Networking

Refer to the following reference documents for CFNetwork:

  • CFFTPStream Reference is the reference documentation for the CFFTPStream API.
  • CFHTTPMessage Reference is the reference documentation for the CFHTTPMessage API.
  • CFHTTPStream Reference is the reference documentation for the CFHTTPStream API.
  • CFHTTPAuthentication Reference is the reference documentation for the CFHTTPAuthentication API.
  • CFHost Reference is the reference documentation for the CFHost API.
  • CFNetService Reference is the reference documentation for the CFNetServices API.
  • CFNetDiagnostics Reference is the reference documentation for the CFNetDiagnostics API.

In addition to the documentation provided by Apple, the following is the reference book for socket-level programming:

  • UNIX Network Programming, Volume 1 (Stevens, Fenner and Rudoff)
0 0
原创粉丝点击