You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
finally, I could use OrchIdSocketImplFactory as tunnel for any socket connections. I went into the problem that nothing was written to the OutputStream, but after disabling the OrchIdSocketImplFactory the program ran fine. I spent hours for debugging the streams and found two possible fixes.
The problem:
A ServerSocket, that accepts a client Socket instantiates a java.net.SocketOutputStream. This class extends FileOutputStream aand immediately writes the data received by the 2 "write" methods out. The "flush" method is empty and is also never called by the application. So if I write 3 bytes, 3 bytes are really written. This causes traffic by sending many small packets, but the stream doesn't wait until its fulfilled (512 bytes).
The fix:
@Override
public synchronized void write(int b) throws IOException {
checkOpen();
if(currentOutputCell == null)
flushCurrentOutputCell();
currentOutputCell.putByte(b);
flushCurrentOutputCell();
}
public synchronized void write(byte[] data, int offset, int length) throws IOException {
checkOpen();
if(currentOutputCell == null)
flushCurrentOutputCell();
while(length > 0) {
final int writeCount = Math.min(length, currentOutputCell.cellBytesRemaining());
currentOutputCell.putByteArray(data, offset, writeCount);
flushCurrentOutputCell();
offset += writeCount;
length -= writeCount;
}
}
I didn't test the socks listener, may this cause any additional problems?
The text was updated successfully, but these errors were encountered:
Hey guys,
finally, I could use OrchIdSocketImplFactory as tunnel for any socket connections. I went into the problem that nothing was written to the OutputStream, but after disabling the OrchIdSocketImplFactory the program ran fine. I spent hours for debugging the streams and found two possible fixes.
The problem:
A ServerSocket, that accepts a client Socket instantiates a java.net.SocketOutputStream. This class extends FileOutputStream aand immediately writes the data received by the 2 "write" methods out. The "flush" method is empty and is also never called by the application. So if I write 3 bytes, 3 bytes are really written. This causes traffic by sending many small packets, but the stream doesn't wait until its fulfilled (512 bytes).
The fix:
I didn't test the socks listener, may this cause any additional problems?
The text was updated successfully, but these errors were encountered: