in my client server application i am going to use java.nio because its supporting 10k client at a time and more performance.i used tcp connection with i want to sent as packet.using udp we can send as a packet(DatagramPacket) in tcp connection how can we send as a packet else we would send ByteArray as a packet.
how to design packet in tcp connection.
another problem in server side is i am using nio with non blocking.so if the client sent as packet even though the nonblocking server will wait to receive full packet its get whatever received from the stream.in this situation how can i solve this problem... please suggest me
Ernest Friedman-Hill
author and iconoclast
Marshal
TCP doesn't work like UDP. You can't send discrete "packets", but only write to a continuous stream of data (underneath, of course, the TCP stack breaks the stream into packets for delivery, but Java doesn't give you any access to that.)
Anyway, I think you probably need to do some basic reading on networking technologies before you go designing this application. You need to understand your terminology better and understand what's possible.
Java's nio is a great idea, but its far more difficult to use well than it should. If you really want to use it, I suggest you look at the Apache Mina framework
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: how to develope tcp protocol in socket connetion