Why such a short run time? - asynchronous

I implemented a solution to the dining philosophers problem in C# (some time ago, can't remember when, can't remember where) and I recently reopened it and added some timing output. The test appears to run for only a few milliseconds when the actual test run takes many, many seconds. In fact, I can force it to run for minutes, though the test still shows less than 500 milliseconds.
In short, I'm creating a collection of Tasks, having them run (on and off) for a few seconds each, looping in the main execution until they complete and writing out the difference between the start and end time.
Here is the NUnit unit test being used to run the solution:
[Test]
public void DoesEveryOneEat_WaitsForAllToFinish()
{
// arrange
var start = DateTime.Now;
// act
foreach (var philosopher in Thinkers)
{
philosopher.StartEating();
}
// wait
bool someoneIsHungry = true;
while (someoneIsHungry)
{
someoneIsHungry = false;
foreach (var philosopher in Thinkers)
{
if (!someoneIsHungry && philosopher.IsHungry)
someoneIsHungry = true;
}
}
Console.WriteLine(DateTime.Now.Subtract(start).Milliseconds);
// assert
Assert.AreEqual(false, Thinkers[0].IsHungry, "Philosopher 0 is hungry and ate for only " + Thinkers[0].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[1].IsHungry, "Philosopher 1 is hungry and ate for only " + Thinkers[1].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[2].IsHungry, "Philosopher 2 is hungry and ate for only " + Thinkers[2].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[3].IsHungry, "Philosopher 3 is hungry and ate for only " + Thinkers[3].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[4].IsHungry, "Philosopher 4 is hungry and ate for only " + Thinkers[4].AteForMillis + " milliseconds.");
}
philosopher.StartEating(); starts a task which runs until a satisfactory outcome has arrived and then exits:
public async void StartEating()
{
await Task.Factory.StartNew(Run);
}
public void Run()
{
while (_totalRunTime < MaxEatMillis)
{
if (Monitor.TryEnter(Left))
{
if (Monitor.TryEnter(Right))
{
Eat();
Monitor.Exit(Right);
}
Monitor.Exit(Left);
}
}
}
While I would welcome constructive comments on this code, my question is: Why does the unit test console output only 582 milliseconds when the test itself does not complete for easily 9 seconds or more?
(I would surmise that this is because the time taken for the actual unit test code to run is only 582 milliseconds but that the NUnit library is not allowing the assertions to run until all tasks started by the test to complete. However, this does not vibe in my head properly, as if writing code which would rely on that fact would fail.)
Full listing:
public class ChopStick
{
public int Index { get; set; }
}
public class Philosopher
{
protected ChopStick Left { get; set; }
protected ChopStick Right { get; set; }
private int _totalRunTime = 0;
private readonly int MaxEatMillis = 3000;
private readonly int MaxRunMillis = 1000;
public Philosopher(ChopStick left, ChopStick right)
{
Left = left;
Right = right;
}
public async void StartEating()
{
await Task.Factory.StartNew(Run);
}
public void Run()
{
while (_totalRunTime < MaxEatMillis)
{
if (Monitor.TryEnter(Left))
{
if (Monitor.TryEnter(Right))
{
Eat();
Monitor.Exit(Right);
}
Monitor.Exit(Left);
}
}
}
private void Eat()
{
var eatTime = new Random().Next(1, MaxRunMillis);
Thread.Sleep(eatTime);
_totalRunTime += eatTime;
}
public bool IsHungry => _totalRunTime < MaxEatMillis;
public int AteForMillis => _totalRunTime;
}
[Test]
public void DoesEveryOneEat_WaitsForAllToFinish()
{
// arrange
var start = DateTime.Now;
Console.WriteLine(DateTime.Now.Subtract(start).Milliseconds);
// act
foreach (var philosopher in Thinkers)
{
philosopher.StartEating();
}
// wait
bool someoneIsHungry = true;
while (someoneIsHungry)
{
someoneIsHungry = false;
foreach (var philosopher in Thinkers)
{
if (!someoneIsHungry && philosopher.IsHungry)
someoneIsHungry = true;
}
}
Console.WriteLine(DateTime.Now.Subtract(start).Milliseconds);
// assert
Assert.AreEqual(false, Thinkers[0].IsHungry, "Philosopher 0 is hungry and ate for only " + Thinkers[0].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[1].IsHungry, "Philosopher 1 is hungry and ate for only " + Thinkers[1].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[2].IsHungry, "Philosopher 2 is hungry and ate for only " + Thinkers[2].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[3].IsHungry, "Philosopher 3 is hungry and ate for only " + Thinkers[3].AteForMillis + " milliseconds.");
Assert.AreEqual(false, Thinkers[4].IsHungry, "Philosopher 4 is hungry and ate for only " + Thinkers[4].AteForMillis + " milliseconds.");
Console.WriteLine(DateTime.Now.Subtract(start).Milliseconds);
}

In your timing code, you should use TotalMilliseconds rather than Milliseconds.
Or just output the TimeSpan directly:
Console.WriteLine(DateTime.Now.Subtract(start));
As a side note, Stopwatch is generally used for timings rather than DateTime.Now.

Related

Unable to create a new Task for progress bar in Java FX

I have created a progress bar in mine Java FXML controller UI and passing the values to it thru executeWSButton. I am creating the new task in createWorker() Method and binding the property value to the progress bar.
The issue is now I am not able to create new Task() in createWorker() method.It was working fine 6 month back and I have resumed the development work . Could you please suggest what could be possible reason here
#FXML
public void executeWSButton(ActionEvent event) {
outputTextScreen.appendText(newLine + " Execution for Process: Started" + newLine);
executeWS.setDisable(true);
progressBar.setProgress(0);
copyWorker = createWorker();
if(testModule != "") {
progressBar.progressProperty().unbind();
progressBar.progressProperty().bind(copyWorker.progressProperty());
new Thread(copyWorker).start();
executeWS.setDisable(false);
}
else {
outputTextScreen.appendText(" Execution for Process: " + Item + " do not have any current TestMethods to Call, Hence stopping the test" + newLine);
}
}
public Task createWorker() {
return new Task() {
#Override
protected Object call() throws Exception {
Invoke_TestNG_Classes ws = new Invoke_TestNG_Classes();
String output = ws.iterateThroughTestCases(inputfile_fp, GIfile_fp, testModule,excelPath);
if(output.contains("Mark atleast"))
{
updateProgress(1.0, 1.0);
outputTextScreen.appendText(
"Please mark atleast one test case with flag as Y in Testcase Execution sheet for "+ Item + newLine);
textOutput.setText("Test Execution Aborted");
return true;
}
while (output.contains("Completed")) {
updateProgress(1.0, 1.0);
// progressBar.setAccessibleText("Completed");
System.out.println(output);
outputTextScreen.appendText("Webservice Execution for Process: " + Item + " Completed" + newLine);
textOutput.setText("Test Execution Completed");
return true;
}
return true;
}
};
}

how to create a synchronous news feed in UWP

I want to create a simple news feed, I use web API to get the news updates, users can use combox select category (world news & sports news),and the news will be auto updated every 5 seconds, if I only select once, the news feed can auto updated and repeat, But if I change the selection, it start to show me both categories. here is my code
public async void NewsRepeat()
{
RootObject2 myNews = await NewsProxy.GetNews();
RootObject3 mySportNews = await sportsNewsProxy.GetSportNews();
if (newsTpye.SelectedIndex==0)
{
for ( k = 0; k <= 8; k++)
{
newsImage.Source = new BitmapImage(new Uri(myNews.articles[k].urlToImage, UriKind.Absolute));
showTime.Text = myNews.articles[k].publishedAt.ToString();
showDescription.Text = "(" + myNews.source + "): " + myNews.articles[k].description;
await Task.Delay(5000);
}
}
else if (newsTpye.SelectedIndex==1)
{
for (k = 0; k <= 8; k++)
{
newsImage.Source = new BitmapImage(new Uri(mySportNews.articles[k].urlToImage, UriKind.Absolute));
showTime.Text = mySportNews.articles[k].publishedAt;
showDescription.Text = "(" + mySportNews.source + "): " + mySportNews.articles[k].description;
await Task.Delay(5000);
}
}
NewsRepeat();
}
private void newsType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
NewsRepeat();
}
Your code runs continuously / infinite loops. NewsRepeat never finishes - so when you change selection your now running two instances of NewsRepeat side by side. Change it again and you're running three, and so on.
On SelectionChanged you want to somehow stop the previous instance of NewsRepeat from running.
(Also, creating BitmapImages in the ViewModel is a bad idea generally - bind the directly in XAML to the URL property - Windows will carry out some performance and memory enhancements for you)
One possible solution is to use a CancellationTokenSource, which is a very simple object you can use to manually throw OperationCanceledException's when you deem it necessary (
frequently used as a pattern to cancel async Tasks). Keep it mind it does not work automatically - it's something you have to handle.
CancellationTokenSource cts = null;
public async void NewsRepeat()
{
cts?.Cancel();
try
{
var localCts = cts = new CancellationTokenSource();
RootObject2 myNews = await NewsProxy.GetNews();
RootObject3 mySportNews = await sportsNewsProxy.GetSportNews();
localCts.Token.ThrowIfCancellationRequested();
if (newsTpye.SelectedIndex == 0)
{
for (k = 0; k <= 8; k++)
{
newsImage.Source = new BitmapImage(new Uri(myNews.articles[k].urlToImage, UriKind.Absolute));
showTime.Text = myNews.articles[k].publishedAt.ToString();
showDescription.Text = "(" + myNews.source + "): " + myNews.articles[k].description;
await Task.Delay(5000);
localCts.Token.ThrowIfCancellationRequested();
}
}
else if (newsTpye.SelectedIndex == 1)
{
for (k = 0; k <= 8; k++)
{
newsImage.Source = new BitmapImage(new Uri(mySportNews.articles[k].urlToImage, UriKind.Absolute));
showTime.Text = mySportNews.articles[k].publishedAt;
showDescription.Text = "(" + mySportNews.source + "): " + mySportNews.articles[k].description;
await Task.Delay(5000);
localCts.Token.ThrowIfCancellationRequested();
}
}
NewsRepeat();
}
catch (OperationCanceledException)
{
// Swallow this exception only - this is probably
// the one we've thrown ourselves
}
}
private void newsType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
NewsRepeat();
}

JavaFX update bullet position UI in a loop

For my school project i have to make a game where a cannon have to shoot a bullet to a airplane, the problem is, when we shoot we can see all the position (X . Y) of the bullet on console but the bullet doesn't update on the UI
Here's the Test code:
vel = Slider.getValue();
double angle = panelNero.getRotate();
boolean dead = false;
while (dead == false) {
double X = P.getLayoutX();
double Y = P.getLayoutY();
if (X > 1 && Y > 1 && X < MP.getWidth() && Y < MP.getHeight()) {
System.out.println("x: " + X + " y: " + Y + " maxX: " + MP.getWidth() + " maxY: " + MP.getHeight());
double x = P.getLayoutX();
double y = P.getLayoutY();
P.setLayoutX(x += (Math.cos(Math.toRadians(angle)) * vel));
P.setLayoutY(y += (Math.cos(Math.toRadians(angle)) * vel));
System.out.println("VIVO");
try {
TimeUnit.MILLISECONDS.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(FileFXMLController.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
System.out.println("MORTO");
P.setLayoutX(pro.posX);
P.setLayoutY(pro.posY);
dead = true;
}
}
Please take a look at this post: Platform.runLater and Task in JavaFX
You can use Platform.runlater() to update your GUI from a non-GUI thread. In this case, your update request is put in a queue and handled by the GUI thread ASAP.
But since this is a more complex iteration, you can consider using a Task on a new Thread.
I suggest you to use something like this:
Task task = new Task<Void>() {
#Override
public Void call() throws Exception {
while (dead == false) {
Platform.runLater(new Runnable() {
#Override
public void run() {
P.setLayoutX(...);
P.setLayoutY(...);
}
});
Thread.sleep(500);
}
}
};
Thread th = new Thread(task);
th.start();

Java Code - ArrayIndexOutofBoundsException

I have written the following code and keep running into this error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at yournamep3.Yournamep3test.main(Yournamep3test.java:23)
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
public class Yournamep3test {
public static void main(String[] args) {
// Check if target file exists
File targetFile = new File(args[0]);
try {
PrintWriter out = new PrintWriter(targetFile);
out.write("\r\nStringed musical Instrument program");
for (int arrayIndex = 0; arrayIndex < 10; arrayIndex++) {
out.write("\r\n\r\n");
out.write("\r\nCreating new Stringed Musical Instrument object now..............");
Yournamep3 violinInstrument = new Yournamep3();
violinInstrument.setNameOfInstrument("Violin # " + (arrayIndex+1));
out.write("\r\nCreated instrument with name - "
+ violinInstrument.getNameOfInstrument());
int num = violinInstrument.getNumberOfStrings();
out.write("\r\nNumber of strings in instrument is " + num);
out.write("\r\nNames of String are ");
String strings[] = violinInstrument.getStringNames();
for (int counter = 0; counter < num; counter++) {
out.write("\r\n" + strings[counter]);
}
out.write("\r\nIs the Instrument playing - "
+ violinInstrument.isPlaying());
out.write("\r\nIs the Instrument tuned - "
+ violinInstrument.isTuned());
out.write("\r\nTuning now.........");
violinInstrument.setTuned(true);
out.write("\r\nIs the Instrument tuned - "
+ violinInstrument.isTuned());
out.write("\r\nCalling the Instrument play method now..");
violinInstrument.startPlayInstrument();
out.write("\r\nIs the Instrument playing - "
+ violinInstrument.isPlaying());
out.write("\r\nStopping playing of instrument..............");
violinInstrument.stopPlayInstrument();
out.write("\r\nIs the Instrument playing - "
+ violinInstrument.isPlaying());
}
out.close();
} catch (IOException e) {
}
}
}
I think the issue is with line 23. Any advice would be appreciated, thanks.
This is the other part of the code yournamep3
public class Yournamep3 {
//fields to determine if the instrument is isTuned,
private boolean isTuned;
//and if the instrument is currently isPlaying.
private boolean isPlaying;
private String name;
private int numberOfStrings = 4; // number of strings
private String nameofStringsInInstrument[] = {"E", "C", "D", "A"}; //an array of string names
//A constructor method that set the isTuned and currently isPlaying fields to false.
public Yournamep3() {
this.isTuned = false;
this.isPlaying = false;
}
/**
* #return the name
*/
public String getNameOfInstrument() {
return name;
}
/**
* #param name the name to set
*/
public void setNameOfInstrument(String nameOfInstrument) {
this.name = nameOfInstrument;
}
// Other methods
public boolean isPlaying() {
return isPlaying;
}
public void setPlaying(boolean playing) {
this.isPlaying = playing;
}
public boolean isTuned() {
return isTuned;
}
public void setTuned(boolean isTuned) {
this.isTuned = isTuned;
}
public void startPlayInstrument() {
System.out.println("The Instrument is now Playing.");
isPlaying = true;
}
public void stopPlayInstrument() {
System.out.println("The Instrument is not Playing anymore.");
isPlaying = false;
}
public void startTuneInstrument() {
System.out.println("The Instrument is Tuned.");
isTuned = true;
}
public void stopTuneInstrument() {
System.out.println("The Instrument is not Tuned.");
isTuned = false;
}
public int getNumberOfStrings() {
return this.numberOfStrings ;
}
public String[] getStringNames() {
return nameofStringsInInstrument;
}
}
I would look at your getStringNames() method for your violinInstrument. It seems to me that it isn't populating your String array properly, or the getNumberOfStrings() method does not give the right number of strings. If you put the code for that up, I can help a bit more.
Line 23 appears to be
Yournamep3 violinInstrument = new Yournamep3();
If that's the case you should check the constructor for Yournamemp3
Since Line 23 is
File targetFile = new File(args [0]);
It indicates that your args object is empty. ArrayIndexOutOfBoundException is thrown to indicate that an array has been accessed with an illegal index. 0 is an illegal index.

How to calculate Android Network Throughput

I am calculating the network throughput
throughput=total packet(received)/total time consumed.
I have created a dedicated socket with the server and uploading and downloading the file. The output which i am getting is not upto the mark
code is as below:
public void uploadTest() throws Exception
{
byte[] arrayOfByte = new byte[BUF_SIZE];
Utility.debugMessage(getName()+" uploadTest getLocalAddress() = "+ mUploadSocket.getLocalAddress()+" getLocalPort() = "+ mUploadSocket.getLocalPort()+" isBound() = "+mUploadSocket.isBound()+" isConnected() = "+ mUploadSocket.isConnected());
DataOutputStream localDataOutputStream = new DataOutputStream(mUploadSocket.getOutputStream());
sendMessage(Constants.MSG_CONN_LATENCY,(int)initiatingConnectionTime/* (System.currentTimeMillis()-initiatingConnectionTime)*/,-1,null);
String uploadFilePath=null;
uploadFilePath= Utility.createFileOnSdCard(testCaseDetails.getFileSize());
int totalCycle=testCaseDetails.getCycle();
double allCycleThroughPut=0;
Utility.debugMessage(getName()+" uploadTest ToTal Available bytes","localDataInputStream.available() :: "+localDataOutputStream.size());
for(int i=1;i<=totalCycle;i++)
{
long totalTime=0L;`enter code here`
long updateDelta=0;
long bytesRead=0L;
long totalReceived=0L;
File testFile = new File(uploadFilePath);
fileSize=testFile.length();
FileInputStream fis = new FileInputStream(testFile);
BufferedInputStream bis = new BufferedInputStream(fis);
while((bytesRead=bis.read(arrayOfByte))>Constants.NO_DATA)
{
long currentTime=System.currentTimeMillis();
localDataOutputStream.write(arrayOfByte,0,(int)bytesRead);
totalReceived+=bytesRead;
int progress=(int)((totalReceived/(double)fileSize)*100);
Utility.debugMessage(NAME+" uploadTest Downloading "," progress = "+progress+"totalSend = "+totalReceived);
updateDelta =System.currentTimeMillis() - currentTime;
if(sendYUpdate)
{//Check y axis max value
sendMessage(Constants.MSG_UPDATE_Y_AXIS_LIMIT,(int)(Utility.calculate(updateDelta, bytesRead).getKilobits()),-1, null);
if(skipCounter==0)
{
sendYUpdate=false;
}
else
{
skipCounter--;
}
}
else
{
sendMessage(Constants.MSG_UPDATE_STATUS,progress,(int) totalReceived, Utility.calculate(updateDelta, bytesRead));
}
totalTime+=updateDelta;
}
bis.close();
long downloadTime=totalTime;
SpeedInfo currentAverageThrougput=Utility.calculate(downloadTime, totalReceived);
allCycleThroughPut+=currentAverageThrougput.getKilobits();
sendMessage(Constants.MSG_CYCLE_STATUS, -1,i,currentAverageThrougput );
sendYUpdate=true;
}
localDataOutputStream.close();
sendMessage(Constants.MSG_COMPLETE_STATUS,(int)(allCycleThroughPut/totalCycle),-1,null);
if(!Constants.RUN_ON_LOCAL)
{
try {
Utility.closeSocket( con,Utility.getSharePrefValue(con, Constants.SERVER_BASE_URL)+"/TestMetrico/metrico/closeConnection",Integer.parseInt(Utility.getSharePrefValue(con, Constants.SOCKET_SERVER_PORT)));
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
public void downloadTest() throws IOException
{
int totalCycle=testCaseDetails.getCycle();
double allCycleThroughPut=0;
for(int i=1;i<=totalCycle;i++)
{
byte[] arrayOfByte = new byte[BUF_SIZE];
if(mDownloadSocket.isClosed())
{
mDownloadSocket=null;
mDownloadSocket=new Socket();
connectDownload();
}
Utility.debugMessage(NAME+" downloadTest Start Downloading LocalAddress = "+ mDownloadSocket.getLocalAddress()+" getLocalPort = "+mDownloadSocket.getLocalPort()+" isBound = "+mDownloadSocket.isBound()+" isConnected = "+mDownloadSocket.isConnected());
DataInputStream localDataInputStream = new DataInputStream(mDownloadSocket.getInputStream());
sendMessage(Constants.MSG_CONN_LATENCY,(int) initiatingConnectionTime /*(System.currentTimeMillis()-initiatingConnectionTime)*/,Constants.PARAMETER_NOT_USED,null);
Utility.debugMessage(NAME+" downloadTest ToTal Available bytes","localDataInputStream.available() :: "+localDataInputStream.available());
float updateDelta=0;
long received=0L;
long totalTime=0L;
long totalReceived=0L;
long currentTime=System.currentTimeMillis();
while (( received=localDataInputStream.read(arrayOfByte)) > Constants.NO_DATA)
{
totalReceived+=received;
int progress=(int)((totalReceived/(double)1048576)*100);
updateDelta = System.currentTimeMillis()-currentTime;
Utility.debugMessage(NAME+" downloadTest Downloading buffer", "Received bytes= "+received+"totalReceived bytes= "+totalReceived+"updateDelta time = "+updateDelta);
if(sendYUpdate)
{//Check y axis max value
sendMessage(Constants.MSG_UPDATE_Y_AXIS_LIMIT,(int)( Utility.calculate(updateDelta, received).getKilobits()),-1, null);
if(skipCounter==0)
{
sendYUpdate=false;
}
else
{
skipCounter--;
}
}
else
{
sendMessage(Constants.MSG_UPDATE_STATUS,progress,(int) totalReceived, Utility.calculate(updateDelta, received));
}
totalTime+=updateDelta;
currentTime=System.currentTimeMillis();
}
long downloadTime=totalTime;//(totalTime-start);
SpeedInfo currentAverageThrougput=Utility.calculate(downloadTime, totalReceived);
allCycleThroughPut+=currentAverageThrougput.getKilobits();
sendMessage(Constants.MSG_CYCLE_STATUS, -1,i,currentAverageThrougput );
sendYUpdate=true;
localDataInputStream.close();
mDownloadSocket.close();
}
sendMessage(Constants.MSG_COMPLETE_STATUS,(int)(allCycleThroughPut/totalCycle),-1,null);
if(!Constants.RUN_ON_LOCAL)
{
try {
Utility.closeSocket( con,Utility.getSharePrefValue(con, Constants.SERVER_BASE_URL)+"/TestMetrico/metrico/closeConnection",Integer.parseInt(Utility.getSharePrefValue(con, Constants.SOCKET_SERVER_PORT)));
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
public static SpeedInfo calculate(final float downloadTime,
final float bytesIn) {
SpeedInfo info = new SpeedInfo();
float downloadTimeTemp = downloadTime;
// if(downloadTimeTemp==0) downloadTimeTemp=1;
// from mil to sec
// TimeUnit.MILLISECONDS.toSeconds(downloadTime)
long bytespersecond = (long) (bytesIn / downloadTimeTemp) * 1000;
double kilobits = bytespersecond * Constants.BYTE_TO_KILOBIT;
double kilobytes = bytespersecond * Constants.BYTE_TO_KILOBYTE;// Constants.BYTE_TO_KILOBIT;
//double megabits = kilobits * Constants.KILOBIT_TO_MEGABIT;
double megabits = bytespersecond*0.000000953674;
info.setDownspeed(bytespersecond);
info.setKilobits(kilobits);
info.setMegabits(megabits);
TotalKB += kilobits;
TotalTime += downloadTime;
Utility.debugMessage(" downloadTest time in Downloading buffer",
"bytespersecond = " + bytespersecond);
Utility.debugMessage(" downloadTest time in Downloading buffer",
"kilobits = " + kilobits);
Utility.debugMessage(" Total downloadTest time in Downloading buffer TotalKB = "
+ TotalKB + " , TotalTime = " + TotalTime);
return info;
}
public static final double EDGE_THRESHOLD = 176.0;
public static final double BYTE_TO_KILOBIT = 0.0078125;
public static final double KILOBIT_TO_MEGABIT = 0.0009765625;
public static final double BYTE_TO_KILOBYTE=0.000976562;
please let me know if some thing is wrong:
300Mbps WIFI router i am gettingenter code here
75Mbps upload and
500 to 750 Mbps download speed
I am running the server on my machine and accessing it via a 300Mbps router over the LAN?

Resources