diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-09-26 23:11:07 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-09-26 23:11:07 +0200 |
commit | 41c4e1f5c817189c8e0bdb8946f90b3236757dfb (patch) | |
tree | 2deaf434863bb1fa0fe6c55d74391a3b69199484 | |
parent | 75a0281a6b04772b818cb7a6a01216fdf523d206 (diff) | |
download | libssh-41c4e1f5c817189c8e0bdb8946f90b3236757dfb.tar.gz libssh-41c4e1f5c817189c8e0bdb8946f90b3236757dfb.tar.xz libssh-41c4e1f5c817189c8e0bdb8946f90b3236757dfb.zip |
Completed senddata example to exit someday
-rw-r--r-- | examples/senddata.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/senddata.c b/examples/senddata.c index d74081a..bd8d117 100644 --- a/examples/senddata.c +++ b/examples/senddata.c @@ -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) { |