which is better sockets/socketchannel why

which is better java.io.Socket / java.nio.channel.SocketChannel
[70 byte] By [blvrka] at [2007-10-2 22:06:45]
# 1
Better for what? They both work. Sockets are simple but only support blocking operations. SocketChannels are about ten times as complex to use but they support non-blocking and multiplexed I/O and also various types of direct and mapped buffering so they can also imply less data movement.
ejpa at 2007-7-14 1:23:27 > top of Java-index,Archived Forums,Socket Programming...
# 2
i am sending data from on client to another client .so which is better in performence
blvrka at 2007-7-14 1:23:27 > top of Java-index,Archived Forums,Socket Programming...
# 3
Performance is mostly determined by the network, so they would both be the same. I would start with Sockets and then see if you have a scalability problem or data copying bottleneck.
ejpa at 2007-7-14 1:23:27 > top of Java-index,Archived Forums,Socket Programming...