Re: A clear example of a server on pthreads.

2020-11-30 Thread Andreas Schneider
On Sunday, 22 November 2020 03:41:11 CET Ogogon !!! wrote:
> Colleagues, please tell me where you can find a simple example of a
> server, which use a posix threads.

For security reasons we recommend to implement a pre-forked server!


Andreas





A clear example of a server on pthreads.

2020-11-21 Thread Ogogon !!!
Colleagues, please tell me where you can find a simple example of a 
server, which use a posix threads.


The examples available to me (samplesshd.c, samplesshd-tty.c, 
samplesshd-kbdint.c) are very straightforward and clear programs that 
can serve only one connection.
I suppose that after ssh_bind_listen() I need to create a new thread 
that will serve the connection from new client, and the main thread 
should return to ssh_bind_listen to wait for the next one.


I have found several functions related to threads, they even provide 
some ready-made mutexes for correct branches. But I didn't really 
understand how to practically use them.
Can I find a clear example somewhere? (I may have searched badly, but in 
my opinion the available documentation is mainly focused on examples of 
client's, but not servers.)


Thanks in advance for your reply,
Ogogon.

P.S. Could someone please answer my previous question?
Ogo.