Package com.peterhi.obsolete

Source Code of com.peterhi.obsolete.RudpEventLoopClient

package com.peterhi.obsolete;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;

import com.peterhi.obsolete.EventLoopRudpLocalEndpoint;
import com.peterhi.obsolete.RudpLocalEndpoint;
import com.peterhi.obsolete.RudpResult;

public class RudpEventLoopClient {

  public static void main(String[] args) throws Exception {
    RudpLocalEndpoint localEndpoint = new EventLoopRudpLocalEndpoint();
    final Thread eventLoopThread = new Thread(localEndpoint);
    eventLoopThread.start();

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

Related Classes of com.peterhi.obsolete.RudpEventLoopClient

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.