Hi, I have successfully compiled libssh2 1.0 with mingw and ported the 
header file to Borland Delphi.

Now I am implementing a wrapper classes but I seem to have trouble with 
the libssh2_channel_wait_closed function.

In the man page I read that I should call this function after 
libssh2_channel_close to give the other side a chance to send missing data.

But when I uncomment the line the program does not return from  
libssh2_channel_wait_closed. What am I doing wrong?????

Please also have a look at the following (Delphi-)Code, do I do the 
right things in the correct order or is some code missing? In the 
examples I saw EOF-Handling fpr scp_write, do I need to implement 
something like this too or is my code complete fot the task (send a 
command to another machine and read out stdin/stderr after command has 
completed)

Thank you in advance and special thanks for creating libssh2, it's a 
great library!!!!

Michael Ring

--- schnipp

  channel := libssh2_channel_open_session(session);
   if Channel = nil then
     RaiseLastLibssh2Error('Open Channel failed');

   CheckAndRaiseSocketError(libssh2_channel_request_pty(channel,'vanilla'));

   libssh2_session_set_blocking(session,1);
   result := libssh2_channel_exec(channel, pChar(command));

   repeat
      rc := libssh2_channel_read(channel,buffer,sizeof(buffer));
     //do something with buffer
   until rc <=0 ;
   repeat
      rc := libssh2_channel_read_stderr(channel,buffer,sizeof(buffer));
      //do something with buffer
   until rc <=0 ;
   rc := libssh2_channel_close(channel);
   //rc := libssh2_channel_wait_closed(channel);
   result := libssh2_channel_get_exit_status(channel);
   rc := libssh2_channel_free(channel);

--- schnapp

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to