[En-Nut-Discussion] function _read and _write

Harald Kipp harald.kipp at egnite.de
Tue Feb 22 09:44:18 CET 2005


Hi Alexander,

Timeout are maintained by the drivers. For U(S)ARTs use

     u_long to = 1000;
     _ioctl(fd, UART_SETREADTIMEOUT, &to);
     _ioctl(fd, UART_SETWRITETIMEOUT, &to);

For TCP sockets (virtual driver) use

     u_long to = 3000;
     NutTcpSetSockOpt(sock, SO_RCVTIMEO, &to, sizeof(to));
     NutTcpSetSockOpt(sock, SO_SNDTIMEO, &to, sizeof(to));

If the number of bytes to _write fit in the transmit
buffer or if the receive buffer contains at least one
byte to _read, they are non blocking. Otherwise a
context switch occurs.

Harald

At 16:52 21.02.2005 -0500, you wrote:
>Hello.
>May I ask: are _read and _write functions blocking ones or not?  Is it
>possible to define timeouts for them using _ioctl  function?
>Thanks, Alexander Baranov.




More information about the En-Nut-Discussion mailing list