Hi,anderson,
  Your solution is effective,it looks great.
  Really admire your work!

Best Regards!

----- Original Message ----- 
From: "Wenrui Guo" <[EMAIL PROTECTED]>
To: "Allen Jiang" <[EMAIL PROTECTED]>; <users@mina.apache.org>; "Apache 
Mina高性能通信框架研究邮件列表" <[EMAIL PROTECTED]>
Sent: Thursday, September 11, 2008 4:25 PM
Subject: RE: How to program implement for different port in server and 
different connection in client


Hi, Allen

To be honest, several months ago, I also have the same confuse. :P BTW, I do 
believe experts in the mailing list can give more proper and complete solution 
than what I will give later.

According to the experience I gained from the source code of MINA 1.x before, I 
think we had better follow the ideas of MINA framework: IoConnector and 
IoAcceptor.

IoConnector represents client side of a socket sesion, while IoAcceptor 
represents the server side. IoConnector and IoAcceptor share the same 
multiplexer programming convention that register 4 kinds of events on Selector. 
No matter how many port and address that bound on IoAcceptor, it only treat 
them as a whole part, so that means you just write your IoHandler 
implementation and don't distinguish where
do they come from.

So in my commercial application, to make program more simpler and 
robust(performance is also brought), I assemble Filters and Handlers for the 
same objective in the same IoAcceptor / IoConnector.

Please look at the following diagram to help you understand what I said:

Server Side:

Port: A, B, C

Port A and Port B serve for the same service, then create a IoAcceptor instance 
and bind to port A and B. Port C is used for other purpose, then create another 
IoAcceptor to listen on port C.

Client Side:

Client can connect to Server A, Server B, and Server C.

Server A and Server B are used to provide business service, while Server C acts 
as logging service. Then I create a IoConnector instance to connect to Server A 
and Server B. Sure, as you image, another IoConnector is only for Logging 
Service.

It's not too sophisticated, isn't it? The approach also simplify and speed up 
programming. However, you can also share you idea as long as you can show you 
reason. :)

Best Regards
anderson 

-----Original Message-----
From: Allen Jiang [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2008 4:04 PM
To: users@mina.apache.org; Apache Mina高性能通信框架研究邮件列表
Cc: Wenrui Guo
Subject: How to program implement for different port in server and different 
connection in client

OK,I explain it again.
How to program implement in MINA according to following two issues:
First, As we know, in server site,MINA support multi-ports for different 
services in a application,My question is that how to implement in program in 
MINA,can it guarantee that different port use different filter and handler?

Secondly,in Client site,how to connect different ports,can it guarantee that 
different connection use different filter and handler?

Best Regards

----- Original Message -----
From: "Wenrui Guo" <[EMAIL PROTECTED]>
To: "Allen" <[EMAIL PROTECTED]>; "Apache Mina高性能通信框架研究邮件列表" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, September 11, 2008 3:35 PM
Subject: RE: 考题:如何在server端开启多个服务端口以及如何在client端连接多个服务端口


Please try to describe you question in english if you want get more help from 
all members of mina community. 

BR
anderson
-----Original Message-----
From: Allen [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2008 3:26 PM
To: Apache Mina高性能通信框架研究邮件列表
Cc: Wenrui Guo; [EMAIL PROTECTED]
Subject: 考题:如何在server端开启多个服务端口以及如何在client端连接多个服务端口

1.在server端,Mina可以支持一个进程中开启多个服务端口进行不同处理,如何实现?能保证不同的端口对应不同的filter和handler
吗?
2. 在Client端,如何在客户端连接多个服务端口?能保证不同的端口对应不同的filter和handler吗?

Reply via email to