Package com.peterhi.obsolete

Examples of com.peterhi.obsolete.Endpoint


import com.peterhi.obsolete.Endpoint;

public class ServerApp {
  public static void main(String[] args) throws Exception {
    Endpoint ep = new Endpoint(22222);
    ep.addEndpointListener((e) -> {
      String reliableStr = e.isReliable() ? "reliable" : "unreliable";
      System.out.println(MessageFormat.format(
        "Received {0} bytes of {1} data.",
        e.getData().length, reliableStr));
    });
   
    ep.start();
  }
View Full Code Here


import com.peterhi.obsolete.Endpoint;

public class ClientApp {
  public static void main(String[] args) throws Exception {
    Endpoint ep = new Endpoint();
    ep.start();
   
    SocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 22222);
    byte[] data = "Hello World!".getBytes();
    ep.send(address, data, false);
  }
View Full Code Here

TOP

Related Classes of com.peterhi.obsolete.Endpoint

Copyright © 2018 www.massapicom. 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.