Messi Chan wrote: > Thx, Trustin. > > > Now I have an other newbie question. > It's about the integrality of the message sent by socket. When I used TCP > connection, > does the message been ensured its integrality. Is that to say, the message > won't been cut down or changed during it's passing through internet? > need I validate their CRC code to make sure their integrality? Or other way? > Or maybe I have not to worried about it? > > thx a lot :D >
A chunk of bytes sent by the client may be sliced up into smaller chunks or merged with other chunks into a single larger chunk. That's the way TCP works. Have a look in the FAQ: http://mina.apache.org/faq.html#FAQ-WhydoesSocketConnectorsendseveralmessagesasonemessage? TCP provides reliable and in-order delivery of data so you shouldn't have to worry about the integrity in most cases. However, in cannot protect you against man-in-the-middle attacks. If your data is sensitive and sent over untrusted networks, SSL or similar protocols will protect your data and guarantee its integrity. MINA has an SSLFilter which you can use in that case. HTH -- Niklas Therning www.spamdrain.net
