Metrologic Optimus S Programming Manual page 145

"c" programming guide
Table of Contents

Advertisement

rp
flags
Example
/* Passive Open (Server) */
conno = Nopen ("*", "TCP/IP", 2000, 0, 0);
/* Active Open (Client) */
char remote_ip[] = "230.145.22.4";
if ((conno = Nopen (remote_ip, "TCP/IP", Nportno(), 2000, 0)) < 0)
printf ("Fail to connect to Host: %s\r\n", remote_ip);
Description
This routine is used for both active and passive opens. The behavior is
determined by the parameters supplied to the function. A passive open will
wait indefinitely. An active open for TCP will return when the connection has
been made, but it times out in a couple of minutes if there is no answer.
Return
If successful, it returns the connection number. This is the handle for further
communication on the connection.
On error, it returns a negative value to indicate a specific error condition.
See Also
Nclose, Nportno, socket_ipaddr, socket_isopen
Chapter 3 Terminal Specific Function Library
Remote port number, For a passive open (server), this value
should be specified as 0, and any remote port will be accepted
for the connection.
Normally, its value is set to 0.
To determine if connection is established, use socket_isopen().
S_NOCON: no connection for UDP
S_NOWA: non-blocking open
IPADDR: remote_ip is binary (4 bytes)
139

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents