开发者

How to 'pipe' or 'chain' output of a server socket to the input of another server socket similar to sendfile?

开发者 https://www.devze.com 2023-04-03 11:26 出处:网络
In开发者_如何学运维 Linux, using sendfile you can directly transfer file out to a socket. But let\'s say we have two server socket, we want to the output of the first one to go out to the second one.

In开发者_如何学运维 Linux, using sendfile you can directly transfer file out to a socket.

But let's say we have two server socket, we want to the output of the first one to go out to the second one.

How to do that? Instead of

data=sock1.read()
sock2.write(data)


I believe dup2 will work

0

精彩评论

暂无评论...
验证码 换一张
取 消