aspose file tools*
The moose likes Java in General and the fly likes Same Code Different Behaviour Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Same Code Different Behaviour" Watch "Same Code Different Behaviour" New topic
Author

Same Code Different Behaviour

Abu Nene
Ranch Hand

Joined: Nov 13, 2008
Posts: 56
Hi guys, any idea why I'm getting different result on different machine with the same piece of code?



One is running using Eclipse java-6-sun-1.6.0.22 on a Ubuntu and the other is running on a Gentoo Java SE Runtime Environment (build 1.6.0_1103).
'
Please advise.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

What are the different outputs?


Mohamed Sanaulla | My Blog
Abu Nene
Ranch Hand

Joined: Nov 13, 2008
Posts: 56
Output that is correct running on Ubuntu.



Output that is not correct running on Gentoo.

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Did you try to run the code twice on same machine?
Abu Nene
Ranch Hand

Joined: Nov 13, 2008
Posts: 56
Mohamed Sanaulla wrote:Did you try to run the code twice on same machine?


Yes. The one that is correct running on Ubuntu always return the same result. The one that is not correct running on Gentoo sometimes return me this.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
And what were the errors? Are you sure the input was the same in both cases?

I think this question is too difficult for "beginning", so I shall move it.
Abu Nene
Ranch Hand

Joined: Nov 13, 2008
Posts: 56
Campbell Ritchie wrote:And what were the errors? Are you sure the input was the same in both cases?

I think this question is too difficult for "beginning", so I shall move it.


There is no error or exception. Initially I thought it's caused by different JDK version. Could it be the machine distance from the server but then again it's unicast using TCP.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

As this program reads the input from the Socket stream, I think the network latency might be the reason for this different output.
Abu Nene
Ranch Hand

Joined: Nov 13, 2008
Posts: 56
Mohamed Sanaulla wrote:As this program reads the input from the Socket stream, I think the network latency might be the reason for this different output.


Any idea how can I resolve this caused by network latency?
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Abu Nene wrote:
Any idea how can I resolve this caused by network latency?

Is this behavior causing other issues? I dont know if there's some way to resolve it or if there's any way to resolve it.
Abu Nene
Ranch Hand

Joined: Nov 13, 2008
Posts: 56
Mohamed Sanaulla wrote:
Abu Nene wrote:
Any idea how can I resolve this caused by network latency?

Is this behavior causing other issues? I dont know if there's some way to resolve it or if there's any way to resolve it.


This is what I did which fix the problem.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Same Code Different Behaviour