It sounds like a Nagle problem. Try setting the NODELAY sockopt. I'm not familiar with that part of the code, but you need to call setTcpNoDelay(true) on the socket that you're talking over. Is that enough to get you looking in the right direction?
yours, Bobby On Mon, Apr 18, 2011 at 6:53 AM, Baldur Norddahl <[email protected]>wrote: > Hello, > > I created a simple ssh server based on sshd 0.5.0. I am attempting to > integrate with jGit, so I created a simple CommandFactory. Everything is > fine, except no output is send to the client until timeout is reached. When > timeout occurs I get all the git output and socket closes. > > To attempt to remedy this I wrapped my output streams in a class that > flushes after every write. But with no luck, I still get no output. The log > files show that output is being written and flushes being called. > > Anyone have an idea why output is not flushed and what I can do about it? > > Thanks, > > Baldur > > // silly flush helper class that does not help the problem > private class FlushOutputStream extends OutputStream { > private OutputStream out; > public FlushOutputStream(OutputStream arg) { > out = arg; > } > @Override > public void close() throws IOException { > out.close(); > } > @Override > public void flush() throws IOException { > out.flush(); > } > @Override > public void write(byte[] b) throws IOException { > System.out.println("write: "+new String(b)); > out.write(b); > out.flush(); > System.out.println("flush"); > } > @Override > public void write(byte[] b, int off, int len) throws IOException { > System.out.println("write: "+new String(b,off,len)); > out.write(b,off,len); > out.flush(); > System.out.println("flush"); > } > @Override > public void write(int arg0) throws IOException { > System.out.println("write: "+new String(new byte[] {(byte)arg0})); > out.write(arg0); > out.flush(); > System.out.println("flush"); > } > > } >
