<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Ole<br>
I see now. I key bit I was missing was that NutTcpSend returns the
number of bytes sent - and therefore returns 0 when it is already busy
sending.<br>
<br>
Thanks for you help.<br>
Trevor<br>
<br>
Ole Reinhardt wrote:<br>
<blockquote cite="mid1099058715.1336.18.camel@platon" type="cite">
<pre wrap="">Hi,
</pre>
<blockquote type="cite">
<pre wrap="">I thought that NutTcpSend does not block (I could be wrong) so how do I do a
blocking send?
</pre>
</blockquote>
<pre wrap=""><!---->
You'r right. It does not block. But it return's the number of bytes
send. So you know how much data you have consumed from your buffer and
can send a "transmit ready" ready event if you'r buffer is empty enough.
Next your control thread should call NutThreadYield() to give up cpu
time. Do this in a loop until no more data is available in your buffer
or even better do this in the mainloop of your thread.
If transmission speed is not that important you also could use
NutSleep() instead of NutThreadYield() and continue sending your buffer
after the sleep. In this case you should set the compilerflag
NUT_CPU_FREQ=x with x should be your clockspeed to get a higher timer
granularity.
Regards,
Ole
</pre>
</blockquote>
</body>
</html>