Users Guide: Network Microcontroller Supplement User Manual

High-Speed Microcontroller Users
Guide: Network Microcontroller
Supplement
199
send
Description: int send(
int s, /* socket on which to send data */
void *buf, /* pointer to transmit data buffer */
int len, /* number of bytes to send */
int flags); /* currently ignored */
The send function writes data to a connection-oriented (TCP) socket. It writes len bytes from the buffer buf to the socket s,
which must be in a connected state. The flags parameter is ignored. Send returns only a local success/failure code and does
not necessarily detect transmission errors.
getsockopt/setsockopt
Descriptions: int getsockopt(
int s
, /* socket for which to get option */
int level, /* curr
ently ignored */
int name, /* option to get */
void *buf, /* buffer to which socket option data is written */
int len); /* length of buf */
int setsockopt(
int s, /* socket for which to set option */
int level, /* currently ignored */
int name, /* option to set */
void *buf, /* buf
fer containing socket option data to set */
int len); /* length of buf */
The getsockopt and setsockopt functions get and set socket options. These functions get/set various options of a socket s.
The option to be read/written is specified by the name parameter
. The *buf parameter points to the buffer to be filled (get oper-
ation) or the option value to be written (set operation). The size of the buffer is len and modified to the size of the filled-in data
by getsockopt. If a socket option needs no data, buf can be NULL. The level parameter is ignored. The getsockopt and set-
sockopt functions return a success/failur
e code in the accumulator.
The following option names are supported:
NAME VALUE DESCRIPTION
TCP_NODELAY 0 Gets/sets the TCP Nagle parameter
SO_LINGER 1
(ignored)
SO_TIMEOUT 2 Gets/sets the socket timeout
SO_BINDADDR 3 Gets the local socket IP (get operation only)
IN PUT PARAM ET ER # –D E S CRI PTIO N OUTPUT D E SCRI PTION
s
leve l
name
*buf
len
Param0[0] –so cket ha nd l e #
Param1 –c urrently ignored
Param2[0] –op t ion t o get/s e t
Param3[0:2]–po in ter to buf
Param4 – l e ngth
of buf
ACC Re turn val
ue (= 0 f
or suc c e s s)
INPUT PARAMETER#–DESCRIPTION OUTPUT DESCRIPTION
s
*buf
len
flags
Param0[0]–socket handle #
Param1[0:2]–pointer to TCP data
Param2[0:1]–# bytes to send
Param3–currently ignored
ACC Return value (= 0 for success)
Maxim Integrated