[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Creating a server
[Thread Prev] | [Thread Next]
- Subject: Creating a server
- From: Levente <leventelist@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 13 Apr 2022 04:16:05 +0200
- To: libssh@xxxxxxxxxx
Hi, I am creating a server application, and I witness some strange thing. I have this code snippet:if (ssh_bind_accept(sshbind, session) == SSH_OK) { /*This will block until a new connection created*/
if (ssh_is_connected(session)) {debug(hm->dbg, DEBUG_INFO, "%s(): CLI: Session is connected.\n", __func__);
} else {debug(hm->dbg, DEBUG_INFO, "%s(): CLI: Session is not connected.\n", __func__);
} ... }And ssh_bind_accept() returns SSH_OK, and I test if the session is connected, but returns 0, which means it is not connected. However the documentation states, that if ssh_bind_accept() returns SSH_OK when a connection is established. The test is right after the call of ssh_bind_accept(), as you can see.
It is very strange as I can see this at the terminal when I connect to my server:
$ ssh -p2048 lev@192.168.10.10 Bad packet length 218759168.ssh_dispatch_run_fatal: Connection to 192.168.10.10 port 2048: message authentication code incorrect
Later, ssh_handle_key_exchange(session) fails with Socket error: disconnected. But still, I can see the socket is connected.
I'm puzzled. Any help are welcome. BR, Lev -- Levente Kovacs Senior Electronic Engineer W: http://levente.logonex.eu
Re: Creating a server | Andreas Schneider <asn@xxxxxxxxxxxxxx> |