Package com.peterhi.net

Examples of com.peterhi.net.Local.addListener()


public final class ServerApp {

  public static void main(String[] args) throws Exception {
    final Local local = new Local(22222);
    local.getSocket().setSoTimeout(10);
    local.addListener(new Listener() {
      @Override
      public void received(Event event) {
        SocketAddress address = event.getAddress();
        byte[] data = event.getData(true);
        System.out.println(MessageFormat.format("Received {0} bytes of data from {1}.", data.length, address));
View Full Code Here


public final class ClientApp {

  public static void main(String[] args) throws Exception {
    final Local local = new Local();
    local.getSocket().setSoTimeout(10);
    local.addListener(new Listener() {
      @Override
      public void received(Event event) {
      }
    });
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.