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

  • Home
  • SEARCH
  • 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 3680048
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:31:51+00:00 2026-05-19T03:31:51+00:00

I am currently trying to write some code which is going to send a

  • 0

I am currently trying to write some code which is going to send a request to a device, and then wait for the response. The problem is the response does not have an end character to indicate the message is complete so we just have to wait a period of time.

What I want to do is send the message and then wait a period of time. Each time a piece of data arrives I want to increment the period of time I am waiting by say another 100ms incase there is any more data to follow. If nothing comes in after that period it is assumed that the message is complete.
This is the pseudo code I came up with:

var waitTime

Function SendData(data)
{
     send the request here and then block with the next code

     while (waitTime)
     {
          //wait
     }
}

Function RecieveData(data)
{
     Assign new data to a buffer
     waitTime++
}

The SendData and RecieveData functions are both on different threads within a class. I am coding this in C#. I have tried implementing this with a DataTime object, but it does not seem to be very accurate when working with 10’s/100’s of milliseconds?

Any advice on what would be the best way to implement this would be appreciated!

Regards
Adrian

  • 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-19T03:31:51+00:00Added an answer on May 19, 2026 at 3:31 am

    Try comparing DateTime.Ticks instead. A tick is 100 nanoseconds. It is as accurate as the system clock. Of course, the difference between two computers may be tremendous (comparitively).

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

Sidebar

Related Questions

I am currently trying to send binary data out through pexpect. For some reason,
I'm trying to write a perl script that determines which users are currently logged
I'm currently trying to read in an XML file, make some minor changes (alter
I have inherited some code which involves a scheduled task that writes data (obtained
I'm currently having fun trying to learn some of the Boost libary. I'm currently
I'm trying to write a small script to change the current directory to my
My current knowledge: If you are trying to write text files in vbscript /
I currently trying to find a solution, how to ensure that a test fails
I'm currently trying out db4o (the java version) and I pretty much like what
I'm currently trying to build a personal website to create a presence on the

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.