[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

how to make java sockets use virtual clock instead of real-time clock

How does the java sockets obtain clock information from the real-time clock. The reason I want to know is, I  have  subclasses of java.net.socket, and java.net.serversocket and I want my sockets to be used by applications that run on a network emulator. The thing is that when I use routines that needs timing information like setSOTimeout, getSOTimeout, I want them to use the virtual clock that my simulator uses instead of the real time physical clock. I hope the question is clear. Thank you for your assistance
0
debrisca
Asked:
debrisca
  • 2
1 Solution
 
CEHJCommented:
The timeouts are given by an offset from now (the time the method executes). You could map that duration to one of your own
0
 
objectsCommented:
Override get/setSOTimeout() and scale the value according to your virtual clock.
0
 
debriscaAuthor Commented:
Well guys, thanks very much, I managed to get it to work by overriding the methods to use the Virtual Clock. I tried to split the points but it ddnt work out for some reason so I gave <b>objects</b> the points.
Thanks
0
 
CEHJCommented:
OK ;-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now