Subject: Re: [libssh2] (no subject)

Re: [libssh2] (no subject)

From: Chris Nystrom <cnystrom.tech_at_gmail.com>
Date: Thu, 18 Oct 2007 13:58:02 -0500

On 9/10/07, Paul Thomas <thomaspu_at_gmail.com> wrote:
> So I take it no one out there has any idea how to actually get things going
> with this library?

I have my own library that encapsulates libssh2 to make it easier to
use. I call it ssh2_lib.
Here is an example running a remote command.

/* exmaple1.c */

#include "ssh2_lib.h"
#include <stdio.h>
#include "../sock_lib/sock_lib.h"

#define SSH_PORT (22)

int main(int argc, char *argv[])
{
        int sock;
        printf("--\n");
        sock = init_tcp_client("shuttle.newio.org", SSH_PORT);
        if (sock <= 0) {
                return (-1);
        }
        if (init_session(sock, "cnystrom", "xxxxxx") != 0) {
                close_socket(sock);
                return (-1);
        }
        if (remote_command("/bin/touch testx3")) {
                printf("Remote command failed.\n");
        } else {
                printf("Remote command succeeded.\n");
        }
        free_session();
        close_socket(sock);
        printf("all done\n--\n");
        return 0;
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-10-18