Completed senddata example to exit someday
Этот коммит содержится в:
родитель
75a0281a6b
Коммит
41c4e1f5c8
@ -3,12 +3,15 @@
|
|||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include "examples_common.h"
|
#include "examples_common.h"
|
||||||
|
|
||||||
|
#define LIMIT 0x100000000
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
ssh_session session;
|
ssh_session session;
|
||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
char buffer[1024*1024];
|
char buffer[1024*1024];
|
||||||
int rc;
|
int rc;
|
||||||
|
long total=0;
|
||||||
|
long lastshown=4096;
|
||||||
session = connect_ssh("localhost", NULL, 0);
|
session = connect_ssh("localhost", NULL, 0);
|
||||||
if (session == NULL) {
|
if (session == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -36,6 +39,13 @@ int main(void) {
|
|||||||
|
|
||||||
|
|
||||||
while ((rc = ssh_channel_write(channel, buffer, sizeof(buffer))) > 0) {
|
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) {
|
if (rc < 0) {
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user