Hi there, What you can do is put messages into a queue in your IO handler and read them out in your client class. This is a bit of a pain, so I had a go at a synchronous API that provides a closer client side programming model to what you're wanting to use - see the patch on https://issues.apache.org/jira/browse/DIRMINA-375.
You could add the new classes in the patch into your own project (probably with a different package name so you don't get confused with real MINA classes) as no changes to existing MINA code are required. Note that in many cases implementing your processing logic in the IO Handler directly is better, but the synchronous send/receive approach is often easier for the simple request/response scenario you describe. Hope that helps, Brad 李健 wrote: > Hi, > > I'm developing my application with MINA1.1.0, It's working fine in > ServerSide, But I'm confused by using IoHandler in ClientSide. > > I'll send R1 to the server and its response data is P1 and there will be > R2-P2, R3-P3 etc. In the past time, I wrote code like this: > > byte[] request = ...; > socketOutputStream.write(request); > byte[] response = ... > socketInputStream.read(response); > ... // deal response data > > Now, for using MINA, I wrote code like this: > > ioConnector.bind(address, ioHandler); > ... // get session > session.write(request); > > The IoHandler which is binded to the ioConnector will deal response data, > but I wanna to get the response data in my client class which sent the > request data but not the IoHandler, so my client code can deal response data > later after sent its request in one method process.(I'll use VMPipe > sometimes, so i must using MINA IoConnector). > > who can give me some advice? > can IoHandler pass the response data through the client class which sent > the request data? > > Thanks. > >
