Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PseudoTcpSocket input stream doesn't support readNBytes #244

Open
indiscrete-void opened this issue Nov 28, 2021 · 0 comments
Open

PseudoTcpSocket input stream doesn't support readNBytes #244

indiscrete-void opened this issue Nov 28, 2021 · 0 comments

Comments

@indiscrete-void
Copy link

Calling readNBytes on InputStream of pseudo tcp socket instance, causes it to hang in loop forever.
I think this behavior is caused by PseudoTcpInputStream#read(byte[], int, int) implementation which doesn't know how to handle length of zero, i.e. when length of zero is provided it loops forever because in these lines:

read = pseudoTcp.recv(buffer, offset, length);

read = pseudoTcp.recv(buffer, offset, length);
if (logger.isLoggable(Level.FINER))
{
    logger.log(Level.FINER,
               "Read Recv read count: " + read);
}
if (read > 0)
{
    return read;
}

read is never more than zero, if length=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant