IoService Details

IoService is an interface that is implemented by the two most important classes in MINA :

  • IoAcceptor
  • IoConnector

In order to build a server, you need to select an implementation of the IoAcceptor interface. For client applications, you need to implement an implementation of the IoConnector interface.

IoAcceptor

Basically, this interface is named because of the accept() method, responsible for the creation of new connections between a client and the server. The server accepts incoming connection requests.

At some point, we could have named this interface 'Server' (and this is the new name in the coming MINA 3.0).

As we may deal with more than one kind of transport (TCP/UDP/...), we have more than one implementation for this interface. It would be very unlikely that you need to implement a new one.

We have many of those implementing classes

  • NioSocketAcceptor : the non-blocking Socket transport IoAcceptor
  • NioDatagramAcceptor : the non-blocking UDP transport IoAcceptor
  • AprSocketAcceptor : the blocking Socket transport IoAcceptor, based on APR
  • VmPipeSocketAcceptor : the in-VM IoAcceptor

Just pick the one that fit your need.

Here is the class diagram for the IoAcceptor interfaces and classes :

IoConnector

As we have to use an IoAcceptor for servers, you have to implement the IoConnector for clients. Again, we have many implementation classes :

  • NioSocketConnector : the non-blocking Socket transport IoConnector
  • NioDatagramConnector : the non-blocking UDP transport IoConnector
  • AprSocketConnector : the blocking Socket transport IoConnector, based on APR
  • ProxyConnector : a IoConnector providing proxy support
  • SerialConnector : a IoConnector for a serial transport
  • VmPipeConnector : the in-VM IoConnector

Just pick the one that fit your need.

Here is the class diagram for the IoConnector interfaces and classes :