[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regarding setting timeout for ssh_sftp


I have tried using a non-blocking mode, It did not work.
The process is still in block state. I may have done a wrong setup
for non-blocking mode.

It will be great help if you can share a code snippet on how to set
it properly.

If you can suggest any other approach to resolve this problem.
That would be great.

Thanks,
Yash K.

On Thu, Apr 30, 2020 at 2:45 AM Jakub Jelen <jjelen@xxxxxxxxxx> wrote:

> On Wed, 2020-04-29 at 22:11 +0530, Yash Katta wrote:
> > Hi,
> >
> > My name is Yash. In my current project, I have used ssh_sftp
> > APIs(sftp_open, sftp_write, sftp_close). When I interrupt my running
> > process(communicating with server) with the following command in my
> > Ubuntu
> > 18.04.
> >
> > sudo iptables -I INPUT -s 3.21.92.53 -j DROP
> >
> > This blocks my complete process.
> >
> > I just want to know how to set up ssh_sftp APIs, so that if the app
> > doesn't
> > get any response from the server. It will not block the my app. After
> > a
> > specified time period, It should return with some error and proceed
> > further.
> >
> > Other suggestions are also welcome.
>
> Does it work if you set the session to non-blocking mode? Note, that at
> this moment, you need to change the mode only after the sftp channel is
> opened because of the bug [1].
>
> But given the way how you "simulate" the timeout, it will also depend
> on the OS configuraiton of TCP timeout.
>
> [1] https://bugs.libssh.org/T220
>
> Regards,
> --
> Jakub Jelen
> Senior Software Engineer
> Security Technologies
> Red Hat, Inc.
>
>
>

References:
Regarding setting timeout for ssh_sftpYash Katta <yash.katta1@xxxxxxxxx>
Re: Regarding setting timeout for ssh_sftpJakub Jelen <jjelen@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org