Chapter 3 Terminal Specific Function Library
139
rp
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.
flags
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)
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
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...