1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-31 00:03:07 +03:00

Completed senddata example to exit someday

This commit is contained in:
Aris Adamantiadis
2010-09-26 23:11:07 +02:00
parent 75a0281a6b
commit 41c4e1f5c8

View File

@ -3,12 +3,15 @@
#include <libssh/libssh.h>
#include "examples_common.h"
#define LIMIT 0x100000000
int main(void) {
ssh_session session;
ssh_channel channel;
char buffer[1024*1024];
int rc;
long total=0;
long lastshown=4096;
session = connect_ssh("localhost", NULL, 0);
if (session == NULL) {
return 1;
@ -36,6 +39,13 @@ int main(void) {
while ((rc = ssh_channel_write(channel, buffer, sizeof(buffer))) > 0) {
total += rc;
if(total/2 >= lastshown){
printf("written %lx\n",total);
lastshown=total;
}
if(total > LIMIT)
break;
}
if (rc < 0) {