How to control the Channel out of Handler object
Michael McGrady
mmcgrady at topiatechnology.com
Tue Sep 15 20:08:33 EDT 2009
I think you want something like the following:
DefaultHttpChunk chunk = new DefaultHttpChunk(buf);
ChannelFuture future = e.getChannel().write(chunk);
future.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) {
if (future.isSuccess()) {
} else {
}
}
});
On Sep 15, 2009, at 10:56 AM, olekg wrote:
>
> Hello,
>
> As I written in another thread I try to build Comet/Streaming
> solution with
> Netty. I have partialy chieved me goal for one-client connection.
>
> The idea for my application is to run timer in singleton object which
> updates all registered Event objects, registered in
> HttpRequestHandler. In
> other words when obtain messageReceived event I do not build the
> response.
> Instead I pass the Event object to be many times used to fill client
> with
> data.
>
> Unofortuanately I have lost the control over transmission erreors. I
> have
> the code :
>
> DefaultHttpChunk chunk = new DefaultHttpChunk( buf);
> ChannelFuture chf = e.getChannel().write(chunk);
> if ( chf.isSuccess() ) {
> System.out.println("Wyprowadzono porcję skryptu przez
> kanał.");
> } else {
> System.out.println("Error");
> Throwable thr = chf.getCause();
> if( thr != null ) {
> System.out.println( thr.getMessage());
> } else {
> System.out.println("Null error object.");
>
> }
>
> }
>
> Regardless of the data is sent correctly or not I malway obtain
> "Error"
> message and "Null error object". I want to know when client
> discnnects.
>
> When I am inside HttpRequestHandler the exceptionCaught event is fired
> correctly. What if I am outside ?
>
> regards Olek
> --
> View this message in context: http://n2.nabble.com/How-to-control-the-Channel-out-of-Handler-object-tp3650670p3650670.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
Mike McGrady
Principal Investigator AF081-028 AFRL SBIR
Senior Engineer
Topia Technology, Inc
1.253.720.3365
mmcgrady at topiatechnology.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090915/0d24413e/attachment-0001.html
More information about the netty-users
mailing list