- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想从 stdin 处理 SSL,并从 stdout 发送 SSL,但 OpenSSL 在 set fd 调用中只接受一个文件描述符:
SSL_set_fd(ssl, sock);
有没有办法将 stdin 和 stdout 文件描述符合并为一个?
我意识到我可以创建一个只从 stdin/out 读取并写入文件描述符的进程,但我试图想出一种方法来避免额外的处理层。
最佳答案
您似乎想使用 SSL_set_rfd() 和 SSL_set_wfd()。来自 the manual :
SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only for the read channel or the write channel, which can be set independently.
关于linux - 有没有办法将 stdin/stdout fds 转换为一个 fd?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52006723/
我正在使用以下设置运行 valgrind: valgrind --tool=memcheck --tool=callgrind --num-callers=20 --track-fds=yes --e
我的 C++ 程序在 Linux 下运行,运行很多子进程,并且在每次 fork 运行子进程后,我关闭所有继承的 fds 以防止子进程访问它们。现在,我的程序也从其父级继承了一些 fds,在程序启动时关
我有一个类似于这里描述的问题: Prevent fork() from copying sockets 基本上,在我的 Lua 脚本中,我生成了另一个脚本: 不需要以任何方式与我的脚本通信 我的脚本完
您好,我想监控来自 libssh 连接 api 的 FD。但也想监控 STDIN,并解析来自 STDIN 的命令。 我可以在 C++ 中使用 poll 来做到这一点吗? 最佳答案 不在标准 C++
我需要将文件描述符附加到 GLIB 主循环。我的问题是文件描述符列表在执行期间未固定。 根据 GLIB 文档,我可以: 使用 g_io_channel_unix_new 为每个 FD 创建一个 GIO
我一直在阅读 libev's source code并偶然发现了这条评论: a) epoll silently removes fds from the fd set. as nothing tell
我知道 fork 和 exec 系列在执行后保留文件描述符。这种行为符合我的需要。同样来自 exec 手册: The exec() family of functions replaces the c
当服务器收到终止信号时,它会退出 select() 监视集合 (fd_set) 中的 fd 的循环。 是否有必要查看 fds 并调用 shutdown(fd, SHUT_RDWR) 如果集合中还有它们
有没有办法在 fd_set 中打印套接字的状态? 假设我有这段代码: int main(int argc, char * argv[]) { int sockfd, newfd, i;
procfs 会告诉我某个进程在任何给定时间正在使用哪个 fds。但是有没有办法确定哪些是开放阅读还是哪些是写作? 在下面的输出中,显然进程所有者(用户“x”)对链接/文件具有读/写访问权限,但这与知
我想从 stdin 处理 SSL,并从 stdout 发送 SSL,但 OpenSSL 在 set fd 调用中只接受一个文件描述符: SSL_set_fd(ssl, sock); 有没有办法将 st
我有一个独特的问题,我的代码中使用的 linux 轮询系统调用获取它等待轮询的 fds,我的意思是每毫秒轮询一次。这会导致 CPU 使用率过高。我提供了 100 毫秒的超时,但似乎没有用。任何人都可以
我正在设计一个程序(C++11,目标 Linux,CentOS 7,如果重要的话),其中一个线程将调用 ppoll 以阻塞多个 fds,而对这些 fds 的任何读/写都将在其他线程上进行.所有这些 f
选择高于 255 的 fds 不检查 fd 是否打开。这是我的示例代码: #include #include #include #include int main() { fd_set
我有两个文件描述符,fd1 和 fd2 我想从中读取和写入。我将它们放在 fd_set 中: fd_set socks; FD_ZERO(&socks); FD_SET(fd1,&socks); F
TL;DR 如何在不继承所有属性(文件描述符、内存映射、工作目录、花哨的新内核功能、... ) 来自 parent ? 在 Linux 系统上创建新进程的两种传统方式是 fork和 clone . l
我是一名优秀的程序员,十分优秀!