Tags

links:
http://tutorials.jenkov.com/java-nio/socketchannel.html
http://thushw.blogspot.com/2009/10/java-bytebuffer-how-does-this-work.html
http://docs.oracle.com/javase/7/docs/api/java/nio/Buffer.html#hasRemaining()
http://tutorials.jenkov.com/java-nio/server-socket-channel.html
http://stackoverflow.com/questions/14225957/socket-vs-socketchannel

summary:
– ByteBuffer keeps track of the last position for read and write, so user doesn’t keep 2 pointers of read index vs write index
– ByteBUffer uses flip to switch read mode and write mode
– SocketChannel client: open, InetSocketAddress, connect (blocking vs non-blocking), isConnectFinish, read, write, close
– after jave 1.4, non-blocking unix-like apis were available

Advertisements