Subject: libssh2_sftp_open() error values

libssh2_sftp_open() error values

From: royconejo <>
Date: Fri, 24 Jul 2009 00:15:25 -0300


How could I know if a given file exists over SFTP? requesting directory
contents in not a good choice (I suppose) because there'll be hundreds of
files and retrieving and searching in that list will be way slower than just
trying to open the file, as one could do in the local filesystem (for
example with fopen, open, etc)

well, libssh2_sftp_open() returns NULL whenever it fails, but how could I
discern if it was because of the ?

Shoud I always expect an errno to be set, even when there was no connection
error? perhaps ERROR_NONE since there was no real error apart from the file
not being there?

And shoud I expect any reliable behaviour when my local or remote machine
lost connection? perhaps LIBSSH2_ERROR_SOCKET_SEND when I unplug my local
machine or LIBSSH2_ERROR_SOCKET_TIMEOUT when the remote host fails?

(Perhaps I'm a little confused and things are not that easy =p)

Thanks in advance =)!

Received on 2009-07-24