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

Page 200

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

200

getsockname

Description:

int getsockname(
int
s,

/* socket for which to get local IP address and port */

struct sockaddr *addr,

/* address where IP address and port should be stored */

int addrlen);

/* size of addr structure */

The

function getsockname returns the local IP and port of the socket s and stores it in the addr structure. It returns a suc-

cess/failure code in the accumulator.

getpeername

Description:

int getpeername(
int
s,

/* socket for which to get the remote IP address */

struct sockaddr *addr,

/* address where IP address should be stored */

int addrlen);

/* length of addr structure */

The

getpeername function returns the remote address of a connection-oriented (TCP) socket. If socket s is connected, get-

peername stores the remote address into the addr structure. This function returns a success/failure code in the accumulator.

cleanup

Description:

int cleanup(
int
pid);

/* task ID of terminated task */

The

cleanup function closes all sockets associated with a task ID. The user’s task manager should call this function whenev-

er a task dies so as to ensure all associated resources are freed by the socket layer. The task ID of the terminated task is pid.

The

cleanup function returns a success/failure code in the accumulator. Note: The DS80C400 silicon software task scheduler

does not call this function. The user should call

cleanup after each task_kill call.

avail

Description:

int avail(
int
s);

/* socket to check availability of received bytes */

The

avail function reports the number of bytes available for recv on a connection-oriented (TCP) socket.

INPUT

PARAMETER#–DESCRIPTION

OUTPUT

DESCRIPTION

s

Param0[0]–socket handle #

ACC

R1:R0

Return value (= 0 for success)

Bytes available for reading

INPUT

PARAMETER#–DESCRIPTION

OUTPUT

DESCRIPTION

pid

Param0[0]–task ID for which

associated sockets

should be closed

ACC

Return value (= 0 for success)

INPUT

PARAMETER#–DESCRIPTION

OUTPUT

DESCRIPTION

s

*addr

addrlen

Param0[0]–socket handle #

Param1[0:2]–pointer to addr

Param2[0]–size of addr structure

ACC

Return value (= 0 for success)

INPUT

PARAMETER#–DESCRIPTION

OUTPUT

DESCRIPTION

s

*addr

addrlen

Param0[0]–socket handle #

Param1[0:2]–pointer to addr

Param2[0]–size of addr structure

ACC

Return value (= 0 for success)

Maxim Integrated

Advertising