Package com.peterhi.working

Source Code of com.peterhi.working.Client

package com.peterhi.working;

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

import com.peterhi.working.EndpointImpl;

public class Client {

  public static void main(String[] args) throws Exception {
    EndpointImpl endpoint = new EndpointImpl(new DatagramSocket());
    SocketAddress address = new InetSocketAddress(InetAddress.getByName("www.peterhi.com"), 22222);
//    SocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 22222);
    endpoint.run();
    System.out.println("unreliable sent: " + endpoint.send(address, new byte[512], 0, 512, false));
    long justnow = System.currentTimeMillis();
    System.out.println("reliable sent: " + endpoint.send(address, new byte[507 * 65536], 0, 507 * 65536, true));
    long now = System.currentTimeMillis();
    System.out.println("time = " + (now - justnow));
    System.exit(0);
  }
 
}
TOP

Related Classes of com.peterhi.working.Client

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.