Hi<div><br></div><div>I&#39;m following the <a href="http://www.jboss.org/file-access/default/members/netty/freezone/guide/3.1/html_single/index.html#d0e489">Writing a Time Server</a> chapter of Netty 3.1 user&#39;s guide.</div>
<div><br></div><div>Here is the code snippet to close the connection after a message is written successfully:</div><div><br></div><div><div><div>ChannelFuture f = ch.write(time);</div><div>f.addListener(new ChannelFutureListener() {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>public void operationComplete(ChannelFuture future) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Channel ch = future.getChannel();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>ch.close();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>});</div><div><br></div><div><br></div><div>I think the above code can also be simplified to the following (?):</div>
</div><div><br></div><div>ChannelFuture f = ch.write(time);</div><div>f.await();</div><div>ch.close();</div><div><br></div><div><br></div><div>Am I correct to say that both approaches are identical?</div><div><br></div></div>
<div><br></div><div>-- <br><br>Hez<br>
</div>