• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Same Code Different Behaviour

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the different outputs?
 
Abu Nene
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Output that is correct running on Ubuntu.



Output that is not correct running on Gentoo.

 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try to run the code twice on same machine?
 
Abu Nene
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Marshal
Posts: 74034
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic