【发布时间】:2012-04-22 16:42:07
【问题描述】:
给定两个网络套接字,在不以任何方式接触内容的情况下,将数据从一个连接到另一个的最有效方法是什么?
有没有办法(系统调用 API)来管理内核空间中的套接字到套接字数据管道,类似于
spliceprovides on Linux? 这就是我目前在 Haskell 中使用splice的方式:Using GNU/Linux system call `splice` for zero-copy Socket to Socket data transfers in Haskell。
【问题讨论】:
-
@ixe013 因为套接字由内核管理,我假设两端都在内核中:/?
-
我的意思是调用socket的代码。换句话说,调用
socket()的代码是否在内核模式下运行?我不知道Windows中有这样的功能,但kernel code and user code can share memory。但我相信您需要自己实现内核代码才能利用它。 User mode code has some control over the data 正在发送,但您正在寻找“无触摸”解决方案,所以这不是答案。 -
@ixe013 调用socket()的代码处于用户模式。
标签: windows sockets haskell network-programming