[Qt-interest] socketDescriptor in MacOSX with libssh2

Filipe Maia filipe at xray.bmc.uu.se
Fri Nov 27 00:22:14 CET 2009


Hi,

I'm trying to use libssh2 with QTcpSocket.
libssh2 requires a socket as returned by the socket(2) function.

I'm trying to replace:

    sock = socket(AF_INET, SOCK_STREAM, 0);

...

    session = libssh2_session_init();
    if (libssh2_session_startup(session, sock)) {
        fprintf(stderr, "Failure establishing SSH session\n");
        return -1;
    }

where sock is a socket connected to the ssh server

by:

m_session = libssh2_session_init();
libssh2_session_startup(m_session, m_socket->socketDescriptor());

where m_socket is a QTcpSocket connected to the ssh server.

But this doesn't seem to work (I get session failed).
Is there a fundamental difference between socketDescriptor() and
what's returned by socket() in MacOSX?

Thanks for the help,
Filipe



More information about the Qt-interest-old mailing list