double fileSizeKB = (fileByteArray.length) / 1024;
double transferTime = timer.getTimeElapsed() / 1000;
double fileSizeMB = fileSizeKB/1000;
double throughput = fileSizeMB/transferTime;
System.out.println("The size of the File was "+fileSizeMB+ " MegaBytes");
System.out.println("Time for transfer was " +timer.getTimeElapsed()/1000+ " Seconds");
System.out.printf("Throughput was %.2f MB Per Second\n",+throughput);
System.out.println("Number of retransmissions: " + retransmissionCounter);
byte[] statMessage = new byte[32];
statMessage[0]= (byte) throughput;
statMessage[1]=(byte) fileSizeMB;
statMessage[2]=(byte) transferTime;
DatagramPacket statPacket = new DatagramPacket(statMessage,statMessage.length,address,port);
socket.send(statPacket);
System.out.println(statMessage[0]);
System.out.println(statMessage[1]);
System.out.println(statMessage[2]);
socket.close();
michael.james.90475 -3 Newbie Poster
michael.james.90475 -3 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.