diff --git a/src/main/java/com/jcraft/jsch/ChannelSftp.java b/src/main/java/com/jcraft/jsch/ChannelSftp.java index 0711f9e..854cfbf 100644 --- a/src/main/java/com/jcraft/jsch/ChannelSftp.java +++ b/src/main/java/com/jcraft/jsch/ChannelSftp.java @@ -803,6 +803,9 @@ public void write(byte[] d, int s, int len) throws java.io.IOException{ try{ int _len=len; while(_len>0){ + if(rwsize<21+handle.length+_len+4) { + flush(); + } int sent=sendWRITE(handle, _offset[0], d, s, _len); writecount++; _offset[0]+=sent;