Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6361527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:47:21+00:00 2026-05-24T23:47:21+00:00

I have a client that every 8 seconds will send a packet to a

  • 0

I have a client that every 8 seconds will send a packet to a server. If the server detects the packets are sent too fast it will disconnect the client. In the client I call Sleep(8000); before sending the packet. On the server side I use GetTickCount(); to calculate the time between the packets. I expected this to work without any problems but I keep getting disconnected.

I used WireShark to check the packet times and this is what I got:
Packet# Time
17 8.656064
72 16.957240
115 24.764741

24.764741 – 16.957240 = 7.807501 < 8 is the reason why I got disconnected.
I don’t understand this because in the client I call Sleep(8000); so it should send packets every 8 seconds or more.

The 2nd packet is late 0.3 second and the 3rd one is early about 0.2.
Is there a way to send these packets in time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:47:22+00:00Added an answer on May 24, 2026 at 11:47 pm

    The problem is actually an age old one; TickCount varies, even between multiple CPUs in the same computer:

    http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/22c68353-1dbb-4718-a8d2-0679fdc0c298/

    My suggestion is set your Sleep to higher then 8000, say 9500, and keep the same mechanic for tickCount, therefore Sleep should always be higher.

    Another link to read is here:

    http://en.wikipedia.org/wiki/Latency_(engineering)#Computer_hardware_and_operating_system_latency

    With specific reference to the paragraph on Microsoft Windows.

    Update:

    I’m not sure why this is getting downvoted but allow me to clarify the problem, as I see it, here.

    TickCount cannot be relied upon as a specific measure of time, other then when it’s localised to one processing unit.
    The first link to MSDN provides citation as to why.

    Secondly, Windows itself may have inaccuracies in its timer logic.

    Lastly, in and of itself, your Crystal based timers may differ as it’s known that atmospheric conditions affect piezoelectric oscillation.

    http://en.wikipedia.org/wiki/Crystal_oscillator#Temperature_effects

    In summary, TickCount isn’t reliable and Getting absolute precision in sending packets over a network is a hard thing to achieve over consumer grade networks.

    My solution, to ensure that the Sleep timer waits longer then the Tick timer isn’t elegant, but enough of a ‘fudge’ to solve the problem.

    You can’t guarantee that a packet will arrive within X seconds, but you can make pretty sure that it won’t be sent before a certain duration has passed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client app that tries every 10 seconds to send a message
I have a client that wants the application to be able to send SMS
I have a client that wants to send a large number of SOAP Header
I have data in a backend server that is updated every minute. I'm writing
I have a C application that sends data to a UDP server every few
I have client application that uses WCF service to insert some data to backend
We have a client that has Oracle Standard , and a project that would
I have a client that is asking me to give them a listing of
I have a client that has a requirement to display PDFs directly within a
I have a client that is paying $1500 per month for hosting of 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.