Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 199

Advertising
background image

High-Speed Microcontroller User’s

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,

/* currently 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,

/* buffer 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/failure 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)

INPUT

PARAMETER#–DESCRIPTION

OUTPUT

DESCRIPTION

s

level

name

*buf

len

Param0[0]–socket handle #

Param1–currently ignored

Param2[0]–option to get/set

Param3[0:2]–pointer to buf

Param4–length of buf

ACC

Return value (= 0 for success)

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

Advertising