C ++应用程序:是否可以将接受的TCP连接从一个进程传递到另一个进程? [英] C++ application: Is it possible to pass accepted TCP connection from one process to another?

查看:327
本文介绍了C ++应用程序:是否可以将接受的TCP连接从一个进程传递到另一个进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我不知道 - 是否可以通过接受TCP连接(在Windows或Unix如操作系统)从一个进程到另一个进程?

So I wonder - is it possible to pass accepted TCP connection (on Windows or Unix like OS) from one process to another? Here the point is to pass connection - not data in a way a proxy app would.

推荐答案

在Windows上,使用 WSADuplicateSocket ,将填写在 WSAPROTOCOL_INFO 到其他进程,请使用

On Windows, use WSADuplicateSocket, pass the filled in WSAPROTOCOL_INFO to the other process, use WSPSocket to recreate a socket.

在类Unix的操作系统上使用 =nofollow> WSPSocket 这可以使用 sendmsg()系统调用。 libancillary 为您提供此信息。

On unix-like OS'es this is possible using the sendmsg() system call. libancillary abstracts this for you.

这篇关于C ++应用程序:是否可以将接受的TCP连接从一个进程传递到另一个进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆