Skip to content

Asynchronous I/O is not implemented correctly #2

Description

@sippykup

WebSocket's send() method is wrong. The write() operation on an asynchronous SocketChannel will only send as many bytes as can be written to the socket's buffer without blocking (which is what makes it asynchronous). So you can't simply assume that you can just call write() once and you're done. There may still be data in the ByteBuffer that needs to be sent. You need to call remaining() on the ByteBuffer to check this.

I'm attaching a rather large patch that implements the asynchronous I/O the right way. So far, it's working for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions