Methods Summary |
---|
public static void | clientTest()
niotestClient();
pause();
oldtestClient2();
pause();
oldtestClient();
pause();
niotestClient();
pause();
oldtestClient2();
pause();
oldtestClient();
|
public static void | createFloats()
for (int i =0; i < FloatArray.length; i++)
FloatArray[i] = ((float) i)/3.2567F;
|
public static void | main(java.lang.String[] args)
createFloats();
test(args);
|
public static void | niotestClient()
outFloatBuffer.clear();
Socket client = new Socket("localhost", PORT);
OutputStream out = client.getOutputStream();
long time = System.currentTimeMillis();
DataOutputStream wrtr = new DataOutputStream(out);
outFloatBuffer.put(FloatArray, 0, FloatArray.length);
wrtr.writeInt(FloatArray.length);
wrtr.write(ByteArray, 0, FloatArray.length*4);
wrtr.flush();
wrtr.close();
time = System.currentTimeMillis() - time;
client.close();
System.out.println("Writing of objects to buffer: " + time);
|
public static void | niotestServer()
inFloatBuffer.clear();
ServerSocket server = new ServerSocket(PORT);
Socket client = server.accept();
InputStream istream = client.getInputStream();
long time = System.currentTimeMillis();
DataInputStream rdr = new DataInputStream(istream);
int len = rdr.readInt();
float[] allFloats = new float[len];
rdr.readFully(ByteArray, 0, len*4);
inFloatBuffer.get(allFloats, 0, len);
time = System.currentTimeMillis() - time;
rdr.close();
client.close();
server.close();
System.out.println("Reading of floats into buffer: " + time);
allFloats = null;
System.gc();
|
public static void | oldtestClient()
Socket client = new Socket("localhost", PORT);
OutputStream out = client.getOutputStream();
long time = System.currentTimeMillis();
DataOutputStream wrtr = new DataOutputStream(out);
wrtr.writeInt(FloatArray.length);
for (int i = 0; i < FloatArray.length ; i++)
{
wrtr.writeFloat(FloatArray[i]);
}
wrtr.flush();
wrtr.close();
client.close();
time = System.currentTimeMillis() - time;
System.out.println("Looped writing of floats to socket: " + time);
|
public static void | oldtestClient2()
Socket client = new Socket("localhost", PORT);
OutputStream out = client.getOutputStream();
long time = System.currentTimeMillis();
ObjectOutputStream wrtr = new ObjectOutputStream(out);
wrtr.writeObject(FloatArray);
wrtr.flush();
wrtr.close();
client.close();
time = System.currentTimeMillis() - time;
System.out.println("writing of float array to socket: " + time);
|
public static void | oldtestServer()
ServerSocket server = new ServerSocket(PORT);
Socket client = server.accept();
InputStream istream = client.getInputStream();
long time = System.currentTimeMillis();
DataInputStream rdr = new DataInputStream(istream);
int len = rdr.readInt();
float[] allFloats = new float[len];
for (int i = 0; i < len ; i++)
{
allFloats[i] = rdr.readFloat();
}
rdr.close();
time = System.currentTimeMillis() - time;
client.close();
server.close();
System.out.println("Looped reading of floats from socket: " + time);
allFloats = null;
System.gc();
|
public static void | oldtestServer2()
ServerSocket server = new ServerSocket(PORT);
Socket client = server.accept();
InputStream istream = client.getInputStream();
long time = System.currentTimeMillis();
ObjectInputStream rdr = new ObjectInputStream(istream);
float[] allFloats = (float[]) rdr.readObject();
rdr.close();
time = System.currentTimeMillis() - time;
client.close();
server.close();
System.out.println("reading of float array from socket: " + time);
allFloats = null;
System.gc();
|
public static void | pause()
Thread.sleep(5000);
|
public void | run()
try{clientTest();}
catch(Exception e){e.printStackTrace();}
|
public static void | serverTest()
niotestServer();
pause();
oldtestServer2();
pause();
oldtestServer();
pause();
niotestServer();
pause();
oldtestServer2();
pause();
oldtestServer();
|
public static void | test(java.lang.String[] args)
(new Thread(new Transfer3())).start();
serverTest();
|