将套接字传递给生成的进程。 [英] passing a socket to a spawned process.

查看:78
本文介绍了将套接字传递给生成的进程。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?在父进程中,我有一个绑定的套接字,

侦听然后接受新连接(在进程中创建新的套接字

)。我希望能够将这些新套接字传递给

一个衍生过程。是否可能,如果是这样的话?


任何帮助都非常感谢!!


Mike

解决方案

2004年10月11日星期一上午10:23:27 -0700,Mike M写道:

有可能吗?在父进程中,我有一个绑定的套接字,
侦听然后接受新的连接(在进程中创建新的套接字)。我希望能够将这些新套接字传递给一个衍生过程。是否可能,如果是这样的话?




只需在fork()之前接受()。套接字将被克隆。然后关闭父母的

套接字,除非需要。


-

(不是这样)随机财富:

(真的)随机财富:

mdione @ tempest:〜


cat / dev / random | uuencode随机| head -n 3

开始644随机

M =?:,8:@ 5MVVIM6> NAYQ6O @ I& H86> .3(L" F7S> U''。 9`2;%LEAR / E8M [* F =(MP

M5C> B3Y2F(X,`SW1UPAL * + OIV''EM / Z


_ -15 '':B#< 6I99_P,H%=

Is it possible? In the parent process, I have a socket that binds,
listens and then accepts new connections (which creates new sockets in
the process). I want to be able to pass some of these new sockets to
a spawned process. Is it possible, and if so how?

Any help is much appreciated!!

Mike

解决方案

On Mon, Oct 11, 2004 at 10:23:27AM -0700, Mike M wrote:

Is it possible? In the parent process, I have a socket that binds,
listens and then accepts new connections (which creates new sockets in
the process). I want to be able to pass some of these new sockets to
a spawned process. Is it possible, and if so how?



just accept() before fork()''ing. the socket will be cloned. then close the
socket on the parent, unless needed.

--
(Not so) Random fortune:
(Really) Random fortune:
mdione@tempest:~


cat /dev/random | uuencode random | head -n 3
begin 644 random
M=?:,8:@5MVVIM6>NAYQ6O@I&H86>.3(L"F7S>U''.9`2;%LEAR/E8M[*F=(MP
M5C>B3Y2F(X,`SW1UPAL*+OIV''EM/Z


_-15'':B#<6I99_P,H%=


这篇关于将套接字传递给生成的进程。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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