
Chapter 3 Terminal Specific Function Library
141
Example
if (socket_cansend (conno, strlen (buf)))
Nwrite (conno, buf, strlen (buf));
Description
This routine writes a number of bytes (
len
) from a specified buffer (
buff
) to a
connection (
conno
).
The protocol stack will keep the data and send them in background. Normally,
this routine will return immediately. However, it will take 1 to 8 seconds to
send the data in the following cases:
Case 1 - In TCP, four packets have been sent, but never get any ACK. The
protocol stack will try to resend the packets until it times out (i.e. 8 seconds).
The application can avoid this situation by using socket_cansend to make sure
the transmission is available before calling Nwrite().
Case 2 - In UDP, the protocol stack does not get MAC ID of the remote side. It
will take 1 second to ask the remote side for MAC ID by ARP.
Return
If successful, it returns the number of bytes written.
On error, it returns a negative value to indicate a specific error condition.
See Also
Nread, socket_cansend
Summary of Contents for Optimus R
Page 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Page 6: ......
Page 8: ...2 C Programming Guide For Optimus S R...
Page 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Page 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Page 24: ...18 C Programming Guide For Optimus S R...
Page 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...