到底什么是沟通渠道?
当我查看 NSFileHandle API 文档时,我发现有很多网络方法谈论套接字和类似的东西......
在顶部,他们说:
NSFileHandle 对象提供了一个 用于访问的面向对象包装器 打开文件或通信渠道。
这里的“沟通渠道”是什么?是否有一些实际示例可以为非网络忍者解释这一点?
When I look at the NSFileHandle API docs, I see there are a lot of networking methods talking about sockets and stuff like that...
At the top, they say:
NSFileHandle objects provide an
object-oriented wrapper for accessing
open files or communications channels.
What's an "communication channel" here? Are there some practical examples that explain it for someone who's not a networking-ninja?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,它是一个抽象,允许您使用通用接口访问各种通信渠道。它适用于发送和/或接收数据字节的大多数事物。
可以是管道(这是同一台计算机上的进程之间进行通信的一种方式);套接字,它基本上是 IP 连接的端点;可以用来交换数据的设备,例如硬件。所有这些都被抽象为一种带有读写指令的类似文件的 IO。
使用文件句柄可以让您忽略底层细节(网络等)并仅获取数据。
Basically it's an abstraction letting you access a variety of communications channels using a common interface. It applies to most things with which you send and/or receive bytes of data.
Could be pipe (which is a way of communicating between processes on the same computer); a socket, which is basically the end point of an IP connection; a device such as a piece of hardware with which you can exchange data. All these get abstracted to a sort of file-like IO with read and write instructions.
Using a file handle lets you ignore the underlying detail (netwworking etc.) and just get at the data.