【发布时间】:2013-10-30 20:51:20
【问题描述】:
我使用 libssh 5.5 实现了一个 SSH 服务器。 在端口 22 上运行一个连接到服务器的 ssh 客户端,一切正常。 当我尝试连接第二个客户端时出现问题(我使用 PUTTY ssh 终端作为客户端)。 ssh_bind_accept 中等待客户端连接的服务端线程没有激活,新打开的(第二个)终端明显‘死’了(第一个打开 终端工作正常)。
我想知道我是否缺少一些重要的设置。
这是我执行的调用:
1. Create the session:
sshbind = ssh_bind_new();
session = ssh_new();
2. Call the listen:
ssh_bind_listen(sshbind)
3. Call the accept:
ssh_bind_accept( sshbind, session )
4. Open a putty terminal, which unlocks the *ssh_bind_accept* at step 3
5. Create a new thread and continue terminal dialogue in newly created thread
基本上,我开发的服务器是基于这里的示例:How to use libssh as server?
必须支持多个客户端,我有一个监听器, 并且当创建连接时(从 ssh_bind_accept 返回),我创建一个新线程并在那里继续 ssh 连接。分叉后,我创建了新的绑定和会话,并让自己等待 ssh_bind 接受。 问题是打开第二个终端不会导致 ssh_bind_accept 返回。
【问题讨论】:
标签: windows multithreading libssh