[En-Nut-Discussion] Generating socket events

Ole Reinhardt ole.reinhardt at kernelconcepts.de
Fri Oct 29 16:05:15 CEST 2004


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

-- 
kernel concepts    Tel: +49-271-771091-14
Dreisbachstr. 24   Fax: +49-271-771091-19
D-57250 Netphen    E+ : +49-177-7420433
--





More information about the En-Nut-Discussion mailing list