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
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.