package com.peterhi.obsolete;
import java.io.IOException;
import com.peterhi.obsolete.EventLoopRudpLocalEndpoint;
import com.peterhi.obsolete.RudpDataEvent;
import com.peterhi.obsolete.RudpDataListener;
import com.peterhi.obsolete.RudpLocalEndpoint;
public class RudpEventLoopServer {
public static void main(String[] args) throws Exception {
RudpLocalEndpoint localEndpoint = new EventLoopRudpLocalEndpoint(22222);
localEndpoint.addListener(new RudpDataListener() {
@Override
public void received(RudpDataEvent event) {
try {
System.out.println("Received " + (event.isReliable() ? "reliable" : "unreliable") +
" data of " + event.getInputStream().available() + " bytes");
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
Thread eventLoopThread = new Thread(localEndpoint);
eventLoopThread.start();
}
}