Package com.peterhi.net2

Source Code of com.peterhi.net2.ServerApp

package com.peterhi.net2;

import com.peterhi.net2.Endpoint.EndpointDataEvent;
import com.peterhi.net2.Endpoint.EndpointDataListener;


public class ServerApp {

  public static void main(String[] args) throws Exception {
    Endpoint endpoint = new Endpoint(22222);
    endpoint.addEndpointDataListener(new EndpointDataListener() {
      @Override
      public void received(EndpointDataEvent event) {
        System.out.println("Received " + new String(event.getData()) + ", from " + event.getAddress());
      }
    });
    Thread thread = new Thread(endpoint);
    thread.start();
   
    System.out.print("Press any key to continue.");
    System.in.read();
    System.exit(0);
  }
 
}
TOP

Related Classes of com.peterhi.net2.ServerApp

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.