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);
}
}