File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Same Code Different Behaviour

 
Abu Nene
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the different outputs?
 
Abu Nene
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Output that is correct running on Ubuntu.



Output that is not correct running on Gentoo.

 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try to run the code twice on same machine?
 
Abu Nene
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47232
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic