Reputation: 83
A part of my program needs to simulate a GPS. So I am setting up a client-server connection. Where on server my main application would run and on client it would send the GPS string periodically after a particular time interval. I am using JAVA for programming it and I am a bit new to networking area, so if someone can just give me an idea about How do i send my data periodically? The emphasis is on just one part. Periodically after a time interval.
Upvotes: 0
Views: 2659
Reputation: 17697
Although your requirement might be simple enough, but i suggest you take a look into quartz scheduler.
It supports from plain simple timer tasks (like every minute or every xx seconds) to the more complex timing scenarios.
Here is one simple example that you can dive more deeply from the source code.
Upvotes: 0
Reputation: 29642
you can use TimerTask Class for your solution. Here is a very useful link for its example.
In its run method you need to deploy your uploading code. I am also working on same kind of project right now.
Upvotes: 2
Reputation: 174
Add a java timer to your code that triggers at the interval you specify. In the timer handler, just run some code to send data to the server.
Upvotes: 1