
Chapter 3 Terminal Specific Function Library
167
socket_hasdata
Purpose
To check if data is available.
Syntax
int socket_hasdata (int conno);
int conno; /* connection number */
Example
if (socket_hasdata (conno))
Nread (conno, buf, sizeof (buf));
Description
This function checks if data from the connection specified
conno
is available to
be read.
Return
If available, it returns a non-zero value.
Otherwise, it returns 0.
See Also
Nread, recv
socket_ipaddr
Purpose
To get the IP address of the remote end of a connection.
Syntax
int socket_ipaddr (int conno, char *ipaddr);
int conno; /* connection number */
char *ipaddr; /* pointer to IP address returned */
Example
unsigned char ip[4];
socket_ipaddr (conno, ip);
printf ("Remote IP: %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]);
Description
This function copies the remote host IP address of the connection specified by
conno
into a buffer indicated by
ipaddr
.
No string terminator is appended by this function.
Return
If successful, it returns 0.
On error, it returns a negative value. (?)
See Also
getpeername
socket_isopen
Purpose
To check if the remote end of a connection is open.
Syntax
int socket_isopen (int conno);
int conno; /* connection number */
Example
if (socket_isopen (conno)) printf ("connected!!");
Description
This function checks if the remote end has entered the ESTABLISHED state.
(TCP only)
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...