<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; ">I think you want something like the following:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><span class="Apple-tab-span" style="white-space:pre">                </span>DefaultHttpChunk chunk = new DefaultHttpChunk(buf);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>ChannelFuture future = <font class="Apple-style-span" color="#7F0055">e.getChannel()</font>.write(chunk);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>future.addListener(<span style="color: #7f0055">new</span> ChannelFutureListener() {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span><span style="color: #7f0055">public</span> <span style="color: #7f0055">void</span> operationComplete(ChannelFuture future) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                </span>if (future.isSuccess()) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                </span>} else {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>});</div><div><div>On Sep 15, 2009, at 10:56 AM, olekg wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>Hello,<br><br>As I written in another thread I try to build Comet/Streaming solution with <br>Netty. I have partialy chieved me goal for one-client connection.<br><br>The idea for my application is to run timer in singleton object which<br>updates all registered Event objects, registered in HttpRequestHandler. In<br>other words when obtain messageReceived event I do not build the response.<br>Instead I pass the Event object to be many times used to fill client with<br>data.<br><br>Unofortuanately I have lost the control over transmission erreors. I have<br>the code :<br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DefaultHttpChunk chunk = new DefaultHttpChunk( buf);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ChannelFuture chf = e.getChannel().write(chunk);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( chf.isSuccess() ) {<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;System.out.println("Wyprowadzono porcję skryptu przez kanał."); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;System.out.println("Error");<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;Throwable thr = chf.getCause();<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;if( thr != null ) {<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;System.out.println( thr.getMessage());<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;} else {<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;System.out.println("Null error object.");<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>Regardless of the data is sent correctly or not I malway obtain "Error"<br>message and "Null error object". I want to know when client discnnects.<br><br>When I am inside HttpRequestHandler the exceptionCaught event is fired<br>correctly. What if I am outside ?<br><br>regards Olek<br>-- <br>View this message in context: <a href="http://n2.nabble.com/How-to-control-the-Channel-out-of-Handler-object-tp3650670p3650670.html">http://n2.nabble.com/How-to-control-the-Channel-out-of-Handler-object-tp3650670p3650670.html</a><br>Sent from the Netty User Group mailing list archive at Nabble.com.<br><br>_______________________________________________<br>netty-users mailing list<br><a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/netty-users<br></div></blockquote></div><br><div apple-content-edited="true"> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Mike McGrady</div><div>Principal Investigator AF081-028 AFRL SBIR</div><div>Senior Engineer</div><div>Topia Technology, Inc</div><div>1.253.720.3365</div><div><a href="mailto:mmcgrady@topiatechnology.com">mmcgrady@topiatechnology.com</a></div></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"> </div><br></body></html>