Metrologic Optimus S Programming Manual page 173

"c" programming guide
Table of Contents

Advertisement

socket_hasdata
Purpose
To check if data is available.
Syntax
int socket_hasdata (int conno);
int conno;
Example
if (socket_hasdata (conno))
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.
Nread, recv
See Also
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;
char *ipaddr;
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;
Example
if (socket_isopen (conno)) printf ("connected!!");
Description
This function checks if the remote end has entered the ESTABLISHED state.
(TCP only)
Chapter 3 Terminal Specific Function Library
Nread (conno, buf, sizeof (buf));
/* connection number */
/* connection number */
/* pointer to IP address returned */
/* connection number */
167

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents