Package com.peterhi.obsolete

Examples of com.peterhi.obsolete.MultithreadedRudpLocalEndpoint


import com.peterhi.obsolete.RudpLocalEndpoint;

public class AboutMeServer {

  public static void main(String[] args) throws Exception {
    RudpLocalEndpoint endpoint = new MultithreadedRudpLocalEndpoint(22222);
    RemoteRegistry registry = new RemoteRegistry(endpoint);
    endpoint.run();

    ArrayList<String> friendNames = new ArrayList<String>();
   
    for (int i = 0; i < 100; i++) {
      friendNames.add("Friend " + i);
View Full Code Here


import com.peterhi.obsolete.RudpResult;

public class MultithreadedClient {

  public static void main(String[] args) throws Exception {
    RudpLocalEndpoint localEndpoint = new MultithreadedRudpLocalEndpoint();
    localEndpoint.run();
   
    SocketAddress socketAddress = new InetSocketAddress(InetAddress.getLocalHost(), 22222);
    StringBuilder string = new StringBuilder();
   
    for (int i = 0; i < 18000/*00*/; i++) {
      string.append("Hello World " + i + "!");
    }
   
    byte[] bytes = string.toString().getBytes();
    RudpResult result = localEndpoint.write(socketAddress, bytes, 0, bytes.length, 0);
    System.out.println("Written 1, ping = " + result.getAveragePing());
    result = localEndpoint.write(socketAddress, bytes, 0, bytes.length, 0);
    System.out.println("Written 2 ping = " + result.getAveragePing());
  }
View Full Code Here

import com.peterhi.obsolete.RudpLocalEndpoint;

public class MultithreadedServer {

  public static void main(String[] args) throws Exception {
    RudpLocalEndpoint localEndpoint = new MultithreadedRudpLocalEndpoint(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();
        }
      }
    });
   
    localEndpoint.run();
  }
View Full Code Here

import com.peterhi.obsolete.RudpLocalEndpoint;

public class AboutMeClient {

  public static void main(String[] args) throws Exception {
    RudpLocalEndpoint endpoint = new MultithreadedRudpLocalEndpoint();
    final RemoteRegistry registry = new RemoteRegistry(endpoint);
    endpoint.run();
   
    SocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 22222);
    final AboutMe aboutMe = registry.subscribe(address, "aboutMe", AboutMe.class);
    System.out.println("object = " + aboutMe);
    System.out.println("name = " + aboutMe.getName());
View Full Code Here

TOP

Related Classes of com.peterhi.obsolete.MultithreadedRudpLocalEndpoint

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.