CFNetwork(一)

CFNetwork_PG CFNetwork Programming Guide is written in English. 立即下载

CFNetwork Concepts

@官方文档翻译-李冰

@译文

CFNetwork是给予你有能力全面的控制协议栈的能力的底层,高性能的框架。它是BSD套接字的延伸扩展,标准套接字抽象API对对象提供简化的任务如FTP和HTTP服务器的连接和解析DNS主机。CFNetwork同时基于BSD套接字的物理和理论。

正如CFNetwork依赖于BSD套接字,还有一些Cocoa类依赖于CFNetwork(比如NSURL)。此外,在Web Kit是一组在窗口显示web内容的Cocoa类。这两个类都是高级并且实现大部分网络协议的细节由自己实现。因此,在软件层的接口看起像图1-1中的图片。

图 1-1 OS X中的CFNetwork和其他的软件层
layers_2x.png

当使用CFNetwork

CFNetwork在BSD套接字之上有一些优点。它提供了run loop 集成,所以如果你的应用程序基于run loop,你可以不用在线程中实现使用网络协议。CFNetwork包含了一些不用自己实现细节的对象去帮助你使用网络协议。比如,用CFFTP API你可以不必实现所有细节的去使用FTP协议。如果你理解网络协议并且需要它们提供的底层控制但是不想去自己实现,CFNetwork可能是正确的选择。

使用CFNetwork代替基础层网络APIs有一些明显的优势。CFNetwork 更多的关注网络协议,而基础层APIs更多的关注数据数据访问,比如通过HTTP或FTP传输数据。尽管基础APIs提供了一些可配置性,CFNetwork提供了更多。更多的基础网络类,阅读 URL Session Programming Guide。

现在你了解了CFNetwork和其他的OS X网络APIs的关系,你准备去熟悉CFNetwork的APIs以及构成CFNetwork底层构造的两个API。

CFNetwork的底层构造

在学习CFNetworkAPIs之前,你必须首先了解CFNetwork最为多数的基础APIs。CFNetwork依赖于Core Foundation框架的两个API,CFSocket和CFStream。了解这些API是使用CFNetwork最基本的环节。

CFSocket API

套接字是网络通信最基本的层级。一个套接字的作用类似与打电话的方式。它允许你连接到另一个套接字(无论本地或者通过网络)并将数据发送到该套接字。

最常见的套接字抽象是BSD套接字。CFSocket就是BSD套接字的抽象。在非常小的开销上,CFSocket提供了BSD套接字所有的功能,并且它将套接字集成到run loop中。CFSocket没有限制基于流的套接字(比如TCP),它可能处理任何类型的套接字。

你可以从scratch使用CFSocketCreate函数,或者从SD套接字使用CFSocketCreateWithNative函数创建一个CFSocket对象。然后,你 可以使用CFSocketCreateRunLoopSource 函数创建run-loop源并使用CFRunLoopAddSource 函数添加套接字到run loop中。这将允许你的CFSocket在接收到消息时无论何时回调函数都会被调用。

阅读 CFSocket Reference更多关于CFSocket API的信息.

CFStream API

读取和写入流提供了一个简单的从不同的媒体和独立的设备交换数据的方法。你可以本地内存、文件或者网络(使用套接字)创建数据流,并且你可以使用流而不用一次性把所有数据加载到内存中。

一个流是在通信路径上连续传输的字节序列。流是单向路径,所以进行双向通信有必要使用输入(读)流和输出(写)流。除了基于文件的数据流,你不能在流中查找;一旦已提供或消耗流数据,则不能在从流中检索流数据。

CFStream是两个新的CFTyoe对象提供了这些抽象流的API:CFReadStream和CFWriteStream。两种类型的流都遵从通常的Core Foundation API约定。更多关于Core Foundation类型的信息,阅读 Core Foundation Design Concepts.

CFStream基于CFSocket之上并且是CFHTTP和CFFTP的基础。就像你看到的图1-2,尽管CFStream不是CFNetwork最正式的部分,但是它几乎是CFNetwork所有的最基础的。

Figure 1-2 CFStream API structure

framework_layers_2x.png

你可以使用读取和写入流几乎以相同的方式作为你的UNIX文件描述符。首先,通过制定的流类型(内存,文件或者套接字)实例化流并且设置任何选项。下一步,打开流并且读取或者写入任意数量的时间。当流存在,你可以通过它的属性获取流的信息。一个流的属性是关于流的任何信息,比如它的源和目的地,这些并不是实际正在读取或者写入数据的一部分。当你不再需要留,关闭并处理它。

CFStream读取或写入流的函数将暂停,或者阻塞当前进程,直到至少有一个字节的数据可以被读取或写入。为了避免当流阻塞时尝试读取或写入流,使用函数的异步版本并在run loop上调度流。当它可能在读取和写入时,不会阻塞调用你的回调函数。

除此之外,CFStream具有Secure Sockets Layer (SSL)协议的内置支持。你可以设置一个包含流的SSL信息的字典,例如要求安全等级或者自签署证书。然后作为kCFStreamPropertySSLSettings属性传入你的流中使流成为一个SSL流。

这章 Working with Streams 描述怎样读写流。

CFNetwork API Concepts

了解CFNetwork框架,你需要去熟悉组成它的块。CFNetwork框架分解成单独的API,每个都包含特定的网络协议。根据应用程序,这些API可以组合使用或者单独使用。大部分编程约定在API中很常见,所以去理解它们每一个都很重要的。

CFFTP API

用CFFTP和FTP服务器通信变得更简单。使用CFFTP API,你可以创建FTP读取流(下载)和FTP写入流(上传)
- 从FTP服务器下载文件
- 上传文件到FTP服务器
- 从FTP服务器下载文件夹列表
- 在FTP服务器创建文件夹

一个FTP流工作像其他的CFNetwork流一样。例如,你可以调用CFReadStreamCreateWithFTPURL函数创建FTP读取流。然后任何时候你都可以调用CFReadStreamGetError函数检查流的状态。

通过设置FTP流的特性,你可以使你的流为它的特定应用程序。例如,如果通过流连接的服务器需要一个用户名和密码,你需要设置适当的属性以便流可以正常的工作。更多的关于FTP不同有效的特性信息阅读 Setting up the Streams.

一个CFFTP流可以用于同步或异步。调用CFReadStreamOpen函数当FTP读取流被创建时打开了指定的FTP服务器连接。使用CFReadStreamRead函数从流中读取和规定读取流引用,CFReadStreamRef当FTP读取流被创建时被返回。CFReadStreamRead函数用FTP服务器输出填充缓存区。

更多使用CFFTP的信息, 见 Working with FTP Servers.

CFHTTP API

去发送和接收HTTP消息,使用CFHTTP API。就像CFFTP是FTP协议的抽象一样,CFHTTP是HTTP协议的一个抽象。

Hypertext Transfer Protocol (HTTP)是一个服务器和客户端之间的请求/响应协议。客户端创建一个请求消息。消息随后被序列化后,这一过程消息被转换成原始字节流。消息直到他们被序列化前不能被传输。随后消息发送到服务器。请求通常访问一个文件,比如网页。服务器响应,返回一个跟着消息的字符串。如果有必要这一过程会重复很多次。

去创建一个HTTP请求消息,你需要指定以下:
- 请求方法, Hypertext Transfer Protocol定义的方法之一,比如OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, 和 CONNECT

  • URL,比如http://www.apple.com

  • HTTP版本,比如版本1.0或1.1

  • 消息头,指定头名,比如User-Agent,和它的值,比如MyUserAgent

  • 消息体

当消息被创建过后,并序列化。序列化之后,一个请求可能看起来像这样:

GET / HTTP/1.0\r\nUser-Agent: UserAgent\r\nContent-Length: 0\r\n\r\n

反序列化是序列化相反的过程。通过反序列化,从客户端或者服务器接受到的一个原始的字节流回复到原生的表示。CFNetwork提供所有函数,需要得到传入的消息类型(请求或响应),HTTP版本,URL,头,体,序列化的消息。

更多使用CFHTTP的有效示例 Communicating with HTTP Servers.

CFHTTPAuthentication API

如果你不用证书(或不正确的证书)发送一个HTTP请求到一个认证服务器,服务器返回一个授权质询(通常称为401或407响应)。CFHTTPAuthentication API提供授权证书去询问HTTP消息。CFHTTPAuthentication支持以下认证方案:

  • Basic
  • Digest
  • NT LAN Manager (NTLM)
  • Simple and Protected GSS-API Negotiation Mechanism (SPNEGO)

在新的OS X v10.4中支持持续请求的能力。在OS X v10.3每次请求质询,你都必须从新开始授权会话。现在,你持有每个服务CFHTTPAuthentication对象集。当你收到401或407响应,找到该服务器合适的对象和证书并应用它们。CFNetwork使用该对象存储的信息尽可能有效的处理请求。

在对持续性的要求支撑上,新版本的CFHTTPAuthentication提供更好的性能。更多怎样使用CFHTTPAuthentication的信息可在 Communicating with Authenticating HTTP Servers获得.

CFHost API

使用CFHost API去获得主机信息,包含主机名,地址和可达信息。请求主机信息的过程被称为调解。

使用CFHost就像使用CFStream一样:

创建一个CFHost对象。

开始调解CFHost对象。
检索地址,主机名或可达信息中的任意一个。

摧毁CFHost对象当你使用完后。
像所有CFNetwork一样,CFHost兼容IPv4和IPv6。使用CFHost,你可以写完全透明的代码处理IPv4和IPv6。

CFHost和其余的CFNetwork紧密结合。例如,有一个CFStream的函数叫CFStreamCreatePairWithSocketToCFHost直接从CFHost对象创建一个CFStream对象。
更多关于 CFHost 对象函数信息, 见 CFHost Reference.

CFNetServices API

如果你想你的应用程序使用Bonjour的注册服务或发现服务,使用CFNetService API。Bonjour是苹果实现的允许你发布、发现和解决网络服务的零配置网络(ZEROCONF)。

为了实现Bonjour,CFNetService API定义了三种对象类型:CFNetService, CFNetServiceBrowser, 和 CFNetServiceMonitor。
一个CFNetService对象代表一个网络服务,比如打印机或一个文件服务器。它包含了另一台计算机解析该服务器的所有信息,如名称、类型、域和端口号。CFNetServiceBrowser是一个用来发现域内的域和网络服务的对象。CFNetServiceMonitor对象是用来监测变化的CFNetService对象,比如在iChat的状态信息。

更全面的Bonjour信息, 见 Bonjour Overview. 更多关于使用 CFNetServices 和 实现 Bonjour的信息, 见 NSNetServices and CFNetServices Programming Guide.

CFNetDiagnostics API

连接到网络的应用程序依赖于一个稳定的连接。如果网络关闭,这将导致应用程序出现问题。采用CFNetDiagnostics API,用户可以自己诊断网络问题比如:

  • 物理连接失败(例如,电缆被拔出)
  • 网络错误(例如,DNS或DHCP服务器不再响应)
  • 配置失败(比如,代理配置不正确)

一旦网络错误被诊断到,CFNetDiagnostics指导用户解决问题。你也许已经看见过如果Safari连接到一个网站出现错误时CFNetDiagnostics的行动。
在图1-3中你可以看到CFNetDiagnostics助手

图 1-3 网络诊断助手

net_diagnostics_2x.png

通过提供CFNetDiagnostics在网络错误的环境下,你可以调用CFNetDiagnosticDiagnoseProblemInteractively函数去引导用户通过提示找到一个解决方案。此外,你可以使用CFNetDiagnostics给用户提供查询连接状态和提供统一错误信息。

怎样整合CFNetDiagnotics到你的应用程序见 Using Network Diagnostics. CFNetDiagnostics is a new API in OS X v10.4.


官方文档

CFNetwork Concepts

CFNetwork is a low-level, high-performance framework that gives you the ability to have detailed control over the protocol stack. It is an extension to BSD sockets, the standard socket abstraction API that provides objects to simplify tasks such as communicating with FTP and HTTP servers or resolving DNS hosts. CFNetwork is based, both physically and theoretically, on BSD sockets.

Just as CFNetwork relies on BSD sockets, there are a number of Cocoa classes that rely on CFNetwork (NSURL, for example). In addition, the Web Kit is a set of Cocoa classes to display web content in windows. Both of these classes are very high level and implement most of the details of the networking protocols by themselves. Thus, the structure of the software layers looks like the image in Figure 1-1.

Figure 1-1 CFNetwork and other software layers on OS X

layers_2x.png

When to Use CFNetwork

CFNetwork has a number of advantages over BSD sockets. It provides run-loop integration, so if your application is run loop based you can use network protocols without implementing threads. CFNetwork also contains a number of objects to help you use network protocols without having to implement the details yourself. For example, you can use FTP protocols without having to implement all of the details with the CFFTP API. If you understand the networking protocols and need the low-level control they provide but don’t want to implement them yourself, then CFNetwork is probably the right choice.

There are a number of advantages of using CFNetwork instead of Foundation-level networking APIs. CFNetwork is focused more on the network protocols, whereas the Foundation-level APIs are focused more on data access, such as transferring data over HTTP or FTP. Although Foundation APIs do provide some configurability, CFNetwork provides a lot more. For more information on Foundation networking classes, read URL Session Programming Guide.

Now that you understand how CFNetwork interacts with the other OS X networking APIs, you’re ready to become familiar with the CFNetwork APIs along with two APIs that form the infrastructure for CFNetwork.

CFNetwork Infrastructure

Before learning about the CFNetwork APIs, you must first understand the APIs which are the foundation for the majority of CFNetwork. CFNetwork relies on two APIs that are part of the Core Foundation framework, CFSocket and CFStream. Understanding these APIs is essential to using CFNetwork.

CFSocket API

Sockets are the most basic level of network communications. A socket acts in a similar manner to a telephone jack. It allows you to connect to another socket (either locally or over a network) and send data to that socket.

The most common socket abstraction is BSD sockets. CFSocket is an abstraction for BSD sockets. With very little overhead, CFSocket provides almost all the functionality of BSD sockets, and it integrates the socket into a run loop. CFSocket is not limited to stream-based sockets (for example, TCP), it can handle any type of socket.

You could create a CFSocket object from scratch using the CFSocketCreate function, or from a BSD socket using the CFSocketCreateWithNative function. Then, you could create a run-loop source using the function CFSocketCreateRunLoopSource and add it to a run loop with the function CFRunLoopAddSource. This would allow your CFSocket callback function to be run whenever the CFSocket object receives a message.

Read CFSocket Reference for more information about the CFSocket API.

CFStream API

Read and write streams provide an easy way to exchange data to and from a variety of media in a device-independent way. You can create streams for data located in memory, in a file, or on a network (using sockets), and you can use streams without loading all of the data into memory at once.

A stream is a sequence of bytes transmitted serially over a communications path. Streams are one-way paths, so to communicate bidirectionally an input (read) stream and output (write) stream are necessary. Except for file-based streams, you cannot seek within a stream; once stream data has been provided or consumed, it cannot be retrieved again from the stream.

CFStream is an API that provides an abstraction for these streams with two new CFType objects: CFReadStream and CFWriteStream. Both types of stream follow all of the usual Core Foundation API conventions. For more information about Core Foundation types, read Core Foundation Design Concepts.

CFStream is built on top of CFSocket and is the foundatio for CFHTTP and CFFTP. As you can see in Figure 1-2, even though CFStream is not officially part of CFNetwork, it is the basis for almost all of CFNetwork.

Figure 1-2 CFStream API structure

framework_layers_2x.png

You can use read and write streams in much the same way as you do UNIX file descriptors. First, you instantiate the stream by specifying the stream type (memory, file, or socket) and set any options. Next, you open the stream and read or write any number of times. While the stream exists, you can get information about the stream by asking for its properties. A stream property is any information about the stream, such as its source or destination, that is not part of the actual data being read or written. When you no longer need the stream, close and dispose of it.

CFStream functions that read or write a stream will suspend, or block, the current process until at least one byte of the data can be read or written. To avoid trying to read from or write to a stream when the stream would block, use the asynchronous version of the functions and schedule the stream on a run loop. Your callback function is called when it is possible to read and write without blocking.

In addition, CFStream has built-in support for the Secure Sockets Layer (SSL) protocol. You can set up a dictionary containing the stream’s SSL information, such as the security level desired or self-signed certificates. Then pass it to your stream as the kCFStreamPropertySSLSettings property to make the stream an SSL stream.

The chapter Working with Streams describes how to use read and write streams.

CFNetwork API Concepts

To understand the CFNetwork framework, you need to be familiar with the building blocks that compose it. The CFNetwork framework is broken up into separate APIs, each covering a specific network protocol. These APIs can be used in combination, or separately, depending on your application. Most of the programming conventions are common among the APIs, so it’s important to comprehend each of them.

CFFTP API

Communicating with an FTP server is made easier with CFFTP. Using the CFFTP API, you can create FTP read streams (for downloading) and FTP write streams (for uploading). Using FTP read and write streams you can perform functions such as:

  • Download a file from an FTP server
  • Upload a file to an FTP server
  • Download a directory listing from an FTP server
  • Create directories on an FTP server
    An FTP stream works like all other CFNetwork streams. For example, you can create an FTP read stream by calling the function CFReadStreamCreateWithFTPURL function. Then, you can call the function CFReadStreamGetError at any time to check the status of the stream.

By setting properties on FTP streams, you can adapt your stream for its particular application. For example, if the server that the stream is connecting to requires a user name and password, you need to set the appropriate properties so the stream can work properly. For more information about the different properties available to FTP streams read Setting up the Streams.

A CFFTP stream can be used synchronously or asynchronously. To open the connection with the FTP server that was specified when the FTP read stream was created, call the function CFReadStreamOpen. To read from the stream, use the CFReadStreamRead function and provide the read stream reference, CFReadStreamRef, that was returned when the FTP read stream was created. The CFReadStreamRead function fills a buffer with the output from the FTP server.

For more information on using CFFTP, see Working with FTP Servers.

CFHTTP API

To send and receive HTTP messages, use the CFHTTP API. Just as CFFTP is an abstraction for FTP protocols, CFHTTP is an abstraction for HTTP protocols.

Hypertext Transfer Protocol (HTTP) is a request/response protocol between a client and a server. The client creates a request message. This message is then serialized, a process that converts the message into a raw byte stream. Messages cannot be transmitted until they are serialized first. Then the request message is sent to the server. The request typically asks for a file, such as a webpage. The server responds, sending back a string followed by a message. This process is repeated as many times as is necessary.

To create an HTTP request message, you specify the following:

  • The request method, which can be one of the request methods defined by the Hypertext Transfer Protocol, such as OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, and CONNECT
  • The URL, such as http://www.apple.com
  • The HTTP version, such as version 1.0 or 1.1
  • The message’s headers, by specifying the header name, such as User-Agent, and its value, such as MyUserAgent
  • The message’s body
    After the message has been constructed, you serialize it. Following serialization, a request might look like this:
GET / HTTP/1.0\r\nUser-Agent: UserAgent\r\nContent-Length: 0\r\n\r\n

Deserialization is the opposite of serialization. With deserialization, a raw byte stream received from a client or server is restored to its native representation. CFNetwork provides all of the functions needed to get the message type (request or response), HTTP version, URL, headers, and body from an incoming, serialized message.

More examples of using CFHTTP are available in Communicating with HTTP Servers.

CFHTTPAuthentication API

If you send an HTTP request to an authentication server without credentials (or with incorrect credentials), the server returns an authorization challenge (more commonly known as a 401 or 407 response). The CFHTTPAuthentication API applies authentication credentials to challenged HTTP messages. CFHTTPAuthentication supports the following authentication schemes:

Basic
Digest
NT LAN Manager (NTLM)
Simple and Protected GSS-API Negotiation Mechanism (SPNEGO)
New in OS X v10.4 is the ability to carry persistency across requests. In OS X v10.3 each time a request was challenged, you had to start the authentication dialog from scratch. Now, you maintain a set of CFHTTPAuthentication objects for each server. When you receive a 401 or 407 response, you find the correct object and credentials for that server and apply them. CFNetwork uses the information stored in that object to process the request as efficiently as possible.

By carrying persistency across request, this new version of CFHTTPAuthentication provides much better performance. More information about how to use CFHTTPAuthentication is available in Communicating with Authenticating HTTP Servers.

CFHost API

You use the CFHost API to acquire host information, including names, addresses, and reachability information. The process of acquiring information about a host is known as resolution.

CFHost is used just like CFStream:

Create a CFHost object.
Start resolving the CFHost object.
Retrieve either the addresses, host names, or reachability information.
Destroy the CFHost object when you are done with it.
Like all of CFNetwork, CFHost is IPv4 and IPv6 compatible. Using CFHost, you could write code that handles IPv4 and IPv6 completely transparently.

CFHost is integrated closely with the rest of CFNetwork. For example, there is a CFStream function called CFStreamCreatePairWithSocketToCFHost that will create a CFStream object directly from a CFHost object. For more information about the CFHost object functions, see CFHost Reference.

CFNetServices API

If you want your application to use Bonjour to register a service or to discover services, use the CFNetServices API. Bonjour is Apple’s implementation of zero-configuration networking (ZEROCONF), which allows you to publish, discover, and resolve network services.

To implement Bonjour the CFNetServices API defines three object types: CFNetService, CFNetServiceBrowser, and CFNetServiceMonitor. A CFNetService object represents a single network service, such as a printer or a file server. It contains all the information needed for another computer to resolve that server, such as name, type, domain and port number. A CFNetServiceBrowser is an object used to discover domains and network services within domains. And a CFNetServiceMonitor object is used to monitor a CFNetService object for changes, such as a status message in iChat.

For a full description of Bonjour, see Bonjour Overview. For more information about using CFNetServices and implementing Bonjour, see NSNetServices and CFNetServices Programming Guide.

CFNetDiagnostics API

Applications that connect to networks depend on a stable connection. If the network goes down, this causes problems with the application. By adopting the CFNetDiagnostics API, the user can self-diagnose network issues such as:

  • Physical connection failures (for example, a cable is unplugged)
  • Network failures (for example, DNS or DHCP server no longer responds)
  • Configuration failures (for example, the proxy configuration is incorrect)

Once the network failure has been diagnosed, CFNetDiagnostics guides the user to fix the problem. You may have seen CFNetDiagnostics in action if Safari failed to connect to a website. The CFNetDiagnostics assistant can be seen in Figure 1-3.

Figure 1-3 Network diagnostics assistant

net_diagnostics_2x.png

By providing CFNetDiagnostics with the context of the network failure, you can call the CFNetDiagnosticDiagnoseProblemInteractively function to lead the user through the prompts to find a solution. Additionally, you can use CFNetDiagnostics to query for connectivity status and provide uniform error messages to the user.

To see how to integrate CFNetDiagnotics into your application read Using Network Diagnostics. CFNetDiagnostics is a new API in OS X v10.4.

CPU设计实战:Loongarch版 lab6--20条指令单周期CPU 这个debug卡我时间最长的就是通用寄存器的写使能信号,当时一直没找到,甚至把golden—trace生成了一遍又一遍,对照test,检查了各种,卡了很长时间,我都以为是我之前哪一步搞错了,或者环境什么的,但是一步步做下来并没有,并且“机器永远是对的”让我终于查到了错。debug到一半才想起来写个博客,就不写过程了,下个lab再写过程。下面是两个模块的代码,运行已通过仿真验证。其他的bug就还好,如果认真跟着。就能马上找出来,,上面的每一句话都很重要。走,按逻辑检查并且查。 阅读详情

相关推荐

基于立创开源ESP32步进电机驱动板硬件设计与优化实践

本文详细介绍了基于立创开源平台的ESP32步进电机驱动板硬件设计与优化实践。重点解析了ESP32-PICO-D4与A4950驱动芯片的选型搭配、电源电路噪声隔离、PCB布局布线技巧以及保护电路设计,为开发者提供了从原理图到PCB的完整优化方案,有效提升驱动板的性能与稳定性。

7z8x2c4v6b9的博客 647

CFNetwork概念(CFNetwork Concepts )

CFNetwork是一个低级别高性能的框架,使你能够精细的控制协议栈。它是BSD套接字的扩展,标准套接字抽象API提供对象来简化任务,例如与FTP和HTTP服务器或解析DNS主机。CFNetwork物理上和理论上都基于BSD套接字。 正如CFNetwork依赖与BSD套接字,有大量的Cocoa类依赖CFNetwork(例如,NSURL)。此外,Cocoa类的web工具包用来在窗口显示网页内容。这

小言的专栏 4115

从网格剖分到结果外推:一文拆解HFSS快速扫频(Fast Sweep)的底层逻辑与性能调优

本文深入解析了HFSS快速扫频(Fast Sweep)技术的底层逻辑与性能调优方法。通过ALPS算法实现频带外推,快速扫频相比离散扫频和插值扫频能提升3-5倍计算效率,特别适用于天线阵列、微波滤波器等宽频带分析场景。文章详细介绍了算法架构、参数优化策略及工程实践中的精度保障机制,帮助工程师高效完成电磁仿真。

weixin_28693447的博客 92

CFNetwork编程指南(一)——CFNetwork概念(CFNetwork Concepts)

CFNetwork是一个低级别高性能的框架,使你能够精细的控制协议栈。它是BSD套接字的扩展,标准套接字抽象API提供对象来简化任务,例如与FTP和HTTP服务器通信或解析DNS主机。CFNetwork物理上和理论上都基于BSD套接字。 正如CFNetwork依赖与BSD套接字,有大量的Cocoa类依赖CFNetwork(例如,NSURL)。此外,Cocoa类的web工具包用来在窗口显示网页内容

ihoudf 1949

如何解决ipa包上传App Store Connect时出现的无效二进制文件问题

本文详细解析了ipa包上传App Store Connect时出现无效二进制文件问题的常见原因及解决方案。从Scheme配置、架构支持到权限声明,提供了全面的检查步骤和实用技巧,帮助开发者快速定位并解决上传问题,确保应用顺利通过审核。

weixin_28833069的博客 315

ComfyUI工作流换脸节点报错ReActorFaceSwap

找到自己ComfyUI安装目录的custom_nodes下是否有这个comfyui-reactor-node-main。大家在借鉴别人工作流进行AI换脸的时候,如果遇到ReActorFaceSwap报错提示,莫慌,看我的,两步解决问题。这里千万注意不要嵌套文件夹,保证点击去这个文件就可以看到内置的配置文件!找到自己ComfyUI安装目录的facerestore_models。如果有这个文件,直接跳过,去下一步。如果没有,可以去Git官网下载。

qq_70810809的博客 9015

CFNetwork简介

CFNetwork Concepts CFNetwork is a low-level, high-performance framework that gives you the ability to have detailed control over the protocol stack. It is an extension to BSD sockets, the standard

把握自己。 3339

微信公众平台 - 微信内置浏览器 WeixinJSBridge.invoke(‘xxx‘) API 报错:system:access_denied(常见于微信支付、分享朋友圈/转发好友等功能)解决方案

微信支付提示System:access_denied,调用微信支付返回:system:access_denied为什么,安卓版微信支付偶尔出现system:access_denied,微信公众号开发分享出现system:access_denied,system:access_denied如何解决?微信WeixinJSBridge.invoke(‘xxx‘)API调用后出现报错,微信内部H5WeixinJSBridge.invokesystem:access_denied,使用微信jssdk时报ac

🏆 前端领域优质创作者 5145

CFNetWork_1

CFNetWork的概念 CFNe't

Dashing_Pro的专栏 558

栅极驱动电路设计(一)

SiC驱动电路设计需满足更高标准,重点包括:驱动电压需18~20V开通、-3~-5V关断;栅极电阻优选5~10Ω以平衡开关性能与可靠性;必须集成欠压保护(阈值11~15V)和快速短路保护。多电平驱动控制通过动态调节栅压和驱动强度优化性能,如前期弱驱动抑制振荡,后期强驱动降低损耗。以NCE120ED65VTP4为例,栅压从18V提升至20V可使导通损耗降低15%。相比传统方案,有源驱动(含数字分段和模拟闭环控制)能更灵活地提升开关速度与效率。

嵌入式老牛的博客 450

华为OD机试新系统真题 【LLM推理批次最大化】

华为OD机试 新系统真题【LLM推理批次最大化】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【LLM推理批次最大化】多语言题解。

qq_45776114的博客 569

[深入浅出Cocoa]iOS网络编程之CFNetwork

[深入浅出Cocoa]iOS网络编程之CFNetwork 罗朝辉 (http://www.cnblogs.com/kesalin/) 本文遵循“署名-非商业用途-保持一致”创作公用协议   一,CFNetwork 简介 首先来回顾下。在前文《[深入浅出Cocoa]iOS网络编程之Socket》中,提到iOS网络编程层次模型分为三层: Cocoa层:NSURL,Bonjour,G...

weixin_34102807的博客 311

AI 智能体(Agent)应用开发工程师 · 进阶面试 (五)

在有多位 Agent 共同参与决策时(如评审委员会、代码审查小组),它们可能提出截然相反的建议。共识机制就是用来在这种冲突中得出唯一行动方案的规则。常用机制:多数投票:每个 Agent 一票,根据投票结果决定。实现简单,但忽略了专业度差异。加权投票:根据 Agent 的角色重要性或历史表现赋予不同权重,例如首席架构师 Agent 的票权重是普通开发者 Agent 的 2 倍。管理者仲裁:由一个权限更高的 Manager Agent 听取各方理由后做出最终裁决。这类似于层级制组织决策。辩论收敛。

篮球界最会写bug的人;程序猿中打球最菜的人。 393

CFNetwork框架解析(一)

iOS网络编程层次模型分为三层: Cocoa层:NSURL, GameKit,WebKit Core Foundation层: 基于C的CFNetwork 和 CFNetServices OS层:基于C 的 BSD socket CFNetwork只是对BSD socket 进行了轻量级的封装,但在iOS中使用CFNetwork的好处是CFNetwork与系统级别的设置以及runloop结合很好,...

qq_28551705的博客 2844

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

CFNetwork解惑系列(一)是否要在kCFStreamEventHasBytesAvailable时读取所有数据

本次话题来自apple邮件列表《Must you read all you can on kCFStreamEventHasBytesAvailable?》 我们知道非block的CFStream一般有两种实现方式,一种是runloop,另一种是polling。在前者中,依靠注册的事件发生时,由runloop调度callback执行相应的工作。对于kCFStreamEventHasByt

Mamong's blog 1653

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

IOS错误分析

1. Undefined symbols for architecture i386:   "_kCFStreamErrorDomainMach", referenced from:       -[AsyncSocket errorFromCFStreamError:] in AsyncSocket.o   "_kCFStreamErrorDomainNetDB", referenced

defeny的专栏 2503

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

IOS学习笔记25—HTTP操作之ASIHTTPRequest(一)

ASIHTTPRequest是一个第三方开源项目,在现在的IOS应用中多使用到这个开源类库来提供网络操作,相比于SDK提供的网络操作类库,ASIHTTPRequest使用上更加方便、效率更高,同时功能也非常强大。这是ASIHttpRequest的官网:http://allseeing-i.com/ASIHTTPRequest/ 以下是官方对ASIHttpRequest的解释: What i...

java开发指南博客 【转载】 173

ASIHTTPRequest下载之断点续传

使用iOS SDK中的HTTP网络请求API,相当的复杂,调用很繁琐,ASIHTTPRequest就是一个对CFNetwork API进行了封装,并且使用起来非常简单的一套API,用Objective-C编写,可以很好的应用在Mac OS X系统和iOS平台的应用程序中。ASIHTTPRequest适用于基本的HTTP请求,和基于REST的服务之间的交互。 导入第三方ASIHTTPRe...

bai97850的博客 171

iOS网络编程模型

  iOS网络编程层次结构也分为三层:   Cocoa层:NSURL,Bonjour,Game Kit,WebKit Core Foundation层:基于 C 的 CFNetwork 和 CFNetServices OS层:基于 C 的 BSD socket   Cocoa层:是最上层的基于 Objective-C 的 API,比如 URL访问,NSStream,Bonjo...

weixin_34088583的博客 314

ASIHTTPRequest终极指南:10分钟快速掌握Objective-C HTTP请求库

🚀 **ASIHTTPRequest** 是一款专为Objective-C开发者打造的强大HTTP请求库,基于CFNetwork API封装,让Mac OS X和iOS应用中的网络通信变得简单高效。作为GitHub加速计划的重要开源项目,它为开发者提供了完整的HTTP客户端解决方案。 ## ✨ 为什么选择ASIHTTPRequest? ASIHTTPRequest为Objective-C开发

gitblog_00098的博客 356

CFNetwork编程指南(CFNetwork Programming Guide)

CFNetwork编程指南简介 CFNetwork是核心服务框架中的一个框架,提供了抽象概念的网络协议库。这些抽象感念使得执行各种网络任务变得更容易,例如: 使用BSD套接字使用SSL或TLS创建加密连接解析DNS主机使用HTTP,验证HTTP和HTTP服务器使用FTP服务器发布、解析和浏览Bonjour 服务(NSNetServices和CFNetServices编程指南中有讨论)。

小言的专栏 2667

CFNetwork

首先看张图:  此乃MAC OS X系统中CFNetwork和其余软件层的结构图。 CFNetwork位于底层,但高效地处理协议栈的操作。BSD套接字提供了一些标准对象来方便操作,如与FTP和HTTP服务器通信,解析DNS主机地址。而CFNetwork就是以BSD套接字为基础。 类似,一些cocoa类,如NSURL,使用标准网络协议与服务器通信,就是以CFNetwork为基础。 除

jackshiny的专栏 652

运行微信支付报错

Undefined symbols for architecture x86_64:   "_kCFStreamNetworkServiceTypeVoIP", referenced from:       -[WXOGCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in libWeChatSDK.a(GCDAsyncSock

superior_yong的专栏 351

集成微信遇到的两个问题

在公司的项目中,需要用的微信支付.下载微信支付的的Demo.无法运行出现以下两个问题: 问题1: 解决办法是  添加库 CFNetwork.framework  libc++.tbd   问题二:上面问题解决后还是无法行:            处理方法:Target->Buid Settings->Linking 下 Other Linker Flags 项添加-all_l

zhaoqin3669的博客 407

CFNetWork

    CFNetWork             iOS网络编程层次模型分为三层: Cocoa层:NSURL,Bonjour,Game Kit,WebKit Core Foundation层:基于 C 的 CFNetwork 和 CFNetServices OS层:基于 C 的 BSD socket       CFNetwork是一种低层的高性能架构,它是基于BSD...

pupin9的专栏 369

iOS CFNetwork Concepts CFNetwork概念 官方文档翻译(三)

原文地址:developer CFNetwork概念 CFNetwork是一个低级的、高性能的框架,使您能够详细的控制协议栈。BSD套接字是一个扩展,提供对象的标准套接字抽象API来简化任务,比如与FTP和HTTP服务器或沟通解决DNS主机。CFNetwork为基础,从主体上和理论上,BSD套接字。 正如CFNetwork依赖于BSD套接字,有大量的Coc

wq820203420的专栏 1231
上一篇: Introduction to CFNetwork Programming Guide(译)
下一篇: CFNetwork(二)
_libing
博客等级 码龄10年 1粉丝 1原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值