[En-Nut-Discussion] Generating socket events

Trevor O'Grady togrady at ntlworld.com
Wed Nov 3 00:35:21 CET 2004


Ole
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.

Thanks for you help.
Trevor

Ole Reinhardt wrote:

>Hi,
>
>  
>
>>I thought that NutTcpSend does not block (I could be wrong) so how do I do a
>>blocking send?
>>    
>>
>
>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
>
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20041102/a9443d90/attachment.html>


More information about the En-Nut-Discussion mailing list