www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: [libssh2] #208: Facing an issue while SFTP copying on Solaris

[libssh2] #208: Facing an issue while SFTP copying on Solaris

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Tue, 01 Feb 2011 09:41:11 -0000

#208: Facing an issue while SFTP copying on Solaris
----------------------+-----------------------------------------------------
  Reporter: babi2ki | Owner:
      Type: defect | Status: new
  Priority: high | Milestone: 1.2.7
 Component: SFTP | Version: 1.2.7
  Keywords: | Blocks:
Blocked By: |
----------------------+-----------------------------------------------------
 Hi,
  If I am trying to integrate libssh2 sample code with my project and it
 gets failed to establishing SSH session. But, when I run the same piece of
 code(sftp_write) separately it works fine for me. One thing I observed is
 that my project uses one socket for communication whereas libssh2 uses
 another for establishing SSH session.

 This issue is applicable only on Solaris and it works fine for me on Linux
 & Windows.
 So, does libssh2 has any issue when establishing a SSH session if one
 socket session is already ON? (Especially on Solaris)

 Initially I found this issue using libcurl which internally uses libssh2.

 Here is the sample libssh2 code which I have used in my project:
 ********************sample code****************
         /*
          * The application code is responsible for creating the socket
          * and establishing the connection
          */
         sock = socket(AF_INET, SOCK_STREAM, 0);

         sin.sin_family = AF_INET;
         sin.sin_port = htons(22);
         sin.sin_addr.s_addr = hostaddr;
         if (connect(sock, (struct sockaddr*)(&sin),
                         sizeof(struct sockaddr_in)) != 0) {
                 fprintf(stderr, "failed to connect!\n");
                 exit(0);
         }

         /* Create a session instance
          */
         session = libssh2_session_init();
         if(!session)
                 exit(0);

         /* Since we have set non-blocking, tell libssh2 we are blocking */
         libssh2_session_set_blocking(session, 1);

         /* ... start it up. This will trade welcome banners, exchange
 keys,
          * and setup crypto, compression, and MAC layers
          */

         rc = libssh2_session_startup(session, sock);

         if(rc) {
                 cout<<"errno = "<<errno<<endl;
                 fprintf(stderr, "Failure establishing SSH session: %d\n",
 rc);
                 exit(0);
         }
 ******************************************
 In my case rc = -1 and errno = 11;

-- 
Ticket URL: <http://trac.libssh2.org/ticket/208>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-02-01

the libssh2 team