Hi.
I’ve recently been working a lot with java.nio, but mainly Channels, SelectionKey’s and ByteBuffers.
I’m having difficulties with reading data through channels. (Everything sent and received through Channels are in plain Bytes). I can send and receive just fine, and my echo server works without problems. But like I said, I can’t interpret the data that is being sent in a useful way.
What I’ve been doing is having test servers running on localhost and connecting to these through telnet. The Data I receive form telnet comes up as either gibberish or what seems to be nothing at all. for Debugging I’ve been trying to echo to the console with System.out.println() the data I’ve received but nothing sensible comes up in the slight. I’ve tried appending strings, reading asCharBuffer etc, the only thing remotely close to an alphabetical letter I’ve come to is the ‘?’ letter… and those only appear after CR.
Plain text is written in telnet and nothing shows up on console no matter what - why is this??