473,386 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

time problems 2

actually i am transmitting data over wireless medium so i have to
control the data ie slow it down thats i have to get a delay in the
transmitting function inversely to the speed of the the processor the
code i have been using is
void delay(int n)
{
clock_t start = clock();
while( ( ( (clock()-start)/CLOCKS_PER_SEC )*1000 )<n) ;

}
the n is calculated frm another function

Nov 15 '05 #1
2 1214
On 1 Oct 2005 13:14:05 -0700, in comp.lang.c , "lucifer"
<um**********@gmail.com> wrote:
actually i am transmitting data over wireless medium so i have to
control the data ie slow it down
I think you have a bigger problem if you need to slow the data
transission rate down because of this. Your algorithm is wrong. How
about a queue which signals or blocks when its full?
thats i have to get a delay in the transmitting function inversely to the speed of the the processor


You /definitely/ have the algo wrong....
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 15 '05 #2
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:91********************************@4ax.com...
On 1 Oct 2005 13:14:05 -0700, in comp.lang.c , "lucifer"
<um**********@gmail.com> wrote:
actually i am transmitting data over wireless medium so i
have to control the data ie slow it down


I think you have a bigger problem if you need to slow the data
transission rate down because of this. Your algorithm is wrong.
How about a queue which signals or blocks when its full?
thats i have to get a delay in the transmitting
function inversely to the speed of the the processor


You /definitely/ have the algo wrong....
--

I agree that "lucifer" does have a ways to go.

There may be some reasons to not over stuff a wireless protocol stack with
too much data.

------
[OT content start]

Bluetooth has a defined by annoying behavior that when the connection is
lost with data in the lower levels of sending or receiving stacks that data
is discarded and never reaches the receiving application.

Depending on just what Bluetooth profile that sending application is using
it may not have access on just how much data was actually discarded.

A specific example of this occurs when the sending application closes the
Bluetooth virtual serial port when the system serial write file returns.

In many Bluetooth stack implementations the virtual serial port driver
returns when the buffer has been sent to the Bluetooth stack, not when the
stack has delivered the data to the receiving application.

When the Bluetooth virtual serial port is closed too soon data will be
discarded and the sending application will not be notified.

This example is of off topic in this group but is offered as a thin
justification as to why someone may need a standard C method to limit the
maximum through put of a function.

[OT content end]
------

One method (lots of hand waving) would be to create the sending function
that counts the number of octets in the buffer to be sent.

Calculate an estimate of how much real time should be required to send that
buffer of octets.

Take a system time stamp before calling the send API.

Take a second system time stamp when the API returns.

Subtract the first stamp from the second giving the API delta time.

Subtract the API delta time from your estimate, then hold off sending
another buffer until that much time has passed.

Exactly how to do this would, of course, be an exercise for the Original
Poster.
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Cameron Laird | last post by:
*The Chronicle of Higher Education*, which is more-or-less authoritative for US university administrations, is spon- soring a discussion on the place of open-source in universities ("... are such...
0
by: Eric S. Johansson | last post by:
more questions about performance measurements in python. I solve the problems I had with shelf by not using it. I'm doing a direct pickle to and from file of an entire dictionary. That knocked off...
6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
3
by: Benny | last post by:
Hi All, In an application I write, I need to have some mapping service, where I can select two locations, which shall calculate the distance and mainly the time(could be approximate) to travel...
17
by: Eric Lindsay | last post by:
Is learning to write CSS a better use of time than finding and using a package that produces complete web pages? I've moved to a new platform (Macintosh), taking with me about 400 personal web...
43
by: Mike MacSween | last post by:
Or something to do with Nulls in PK. Which is obviously wrong. OK, after a diversion of having to earn money its back to the free one. The orchestral management system. At the E-R level: An...
4
by: HNguyen | last post by:
Hi, I have a Web application in ASP.NET. My Application allows the users upload files into the server after checking their user names and passwords. For each transaction, the Web program will...
6
by: dredge | last post by:
Hi, the server that hosts my PHP pages has its clock set to Greenwich Mean Time (GMT timezone 0). I need for my PHP scripts to have access to my local time which is Central Standard Time in the...
5
by: Charles May | last post by:
Anyone have a simple concept for the best way to store timeclock information in a database. I currently have my table set up like this with a typical daily entry. tcID empID Type ...
27
by: CodeMonk3y | last post by:
gotta question on sizeof keyword does the sizeof keyword calcuates the size at compile time or run time ?? -- Posted on news://freenews.netfront.net - Complaints to news@netfront.net --
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.