[xSocket-develop] General technical question (request for idea)
Status: Inactive
Brought to you by:
grro
|
From: Thomas S. <ts...@ib...> - 2008-02-17 12:28:38
|
Hello, I'm in the process of writing a socket server which basically receives data according to a self-defined protocol from mobile devices. The data is a mix of line-oriented character data (terminated with a '\n') and some kind of payload, which is a ZLib compressed byte stream. E.g., the client sends the following data in the following sequence to the server. Identifier\n Checksum value\n Length of compressed payload\n ZLib compressed payload byte stream In a first step, I have written a multi-threaded socket server, which uses common IO classes like DataInputStream. Performance is ok on a local area network, but due to the blocking issue of any read method of a DataInputStream, performance is pretty bad, especially in a low-bandwith network. So I came across NIO and xSocket as one framework using Java NIO. How can I implement a socket server with xSocket which: * Implements the protocol as shown above (mix of line-oriented characters and a ZLib compressed byte stream) * Is non-blocking, so at least a few number of simultaneous clients are handled gracefully * Of course, each client needs to be isolated from each other Any hints, code snippets, ... are much appreciated. Thank you very much. Regards, Thomas |