Metrologic Optimus S Programming Manual page 171

"c" programming guide
Table of Contents

Advertisement

Supplemental Functions
Other useful functions for obtaining additional information or setting control for a
connection are described below.
Nportno
Purpose
To get an ephemeral port number.
Syntax
int Nportno (void);
Example
if ((conno = Nopen (remote_ip, "TCP/IP", Nportno(), 2000, 0)) < 0)
Description
This function generates a random local port number, which is used in a active
open call to the Nopen() function.
It always returns the port number.
Return
See Also
Nopen
DNS_resolver
Purpose
To get the remote IP address by remote name.
Syntax
int DNS_resolver (const char *remote_host, char *remote_ip);
const char *remote_host;
char *remote_ip;
Example
char IP[4];
DNS_resolver ("www.metrologic.com", IP);
Description
This function gets the remote IP address by remote name. It is necessary to
define the DNS server IP before calling this function.
If successful, it returns 0.
Return
On error, it returns a negative value. (?)
See Also
gethostbyname
socket_block
Purpose
To set the connection for blocking operation.
int socket_block (int conno);
Syntax
int conno;
Example
socket_block (conno)
Chapter 3 Terminal Specific Function Library
Printf ("Fail to connect Host: %s\r\n", remote_ip);
/* remote name */
/* pointer to remote_ip returned */
/* connection number */
165

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents