Subject: libssh2 - Shell command not being acted upon

libssh2 - Shell command not being acted upon

From: Phillip Wu <Phillip.Wu_at_lands.nsw.gov.au>
Date: Mon, 25 May 2009 14:40:55 +1000

  Hi, I have started using libssh2. I have used ssh2.c example from the download bundle. This program after user authenitcation: channel = libssh2_channel_open_session(session) libssh2_channel_request_pty(channel, "vanilla") libssh2_channel_shell(channel) ..... libssh2_channel_free(channel) channel = NULL At the ..., I have added the following code to read the login information generated from the remote server: libssh2_session_set_blocking(session,0); alarmclock=0; signal(SIGALRM,&alarmed); alarm(timetowait); while (alarmclock==0) { libssh2_channel_read(channel,buf,sizeof(buf)); sleep(1); } libssh2_session_set_blocking(session,1); Sure enough the I get the login information. However when I send the "date" command, I do not get any output from the server: sprintf(buf,"date\r"); libssh2_channel_write(channel,buf,strlen(buf)); .......<- the same "read" code as above Can someone please explain where I have gone wrong? Thanks for any help! *************************************************************** This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily the views of the Department of Lands. This email message has been swept by MIMEsweeper for the presence of computer viruses. *************************************************************** Please consider the environment before printing this email.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com

_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-05-25