xSocket和MINA

从theserverside.com摘录下来的

First of all MINA is also a good NIO implementation. From the performance view there shouldn’t be big differences.

The major difference is the key abstraction. xSocket works on Connections for stream-based communication (TCP) and Endpoints for packet-based communication (UDP). By using MINA you would work on handlers and (in most cases?) on messages.

For a simple TCP-based server based on MINA (see the MINA echo server example), you would have to implement a handler, to receive the incoming message (a ByteBuffer), work on it (may be based on former ByteBuffers if more than an echo should be written), and write the response message (ByteBuffer or array of ByteBufffers) by using a session instance.

By using xSocket you would also have a handler to be notified, but you would only work on a connection object, which represents the underlying (TCP) connection instance. That means data will be written and read by using methods of the connection object. A connection also supports convenience methods like methods to read data which is scattered over several ByteBuffers (readStringByDelimiter would be a typically example for this). Beside performance issues a major goal of xSocket is to allow intuitive programming. 

 

你可能感兴趣的:(server,session,tcp,Mina,performance,methods)