Solvline PB2xxxUG User Manual

Page 83

Advertising
background image

U_listen

TCP

Listen

Description This function enables connections to a socket. It also specified only one

unaccepted connection that can be pending at one time.

Synopsis

int U_listen (int socket_no)

Parameters socket_no

: Socket descriptor

Returns

-1

: If the socket is invalid or unable to listen

1~n

: A descriptor that references the socket if successful

U_accept

Wait

TCP

Accept

Description This function accepts a connection on a socket, and returns a new socket

created for the connection. It blocks, up to the specified sec and usec, until a
new socket generates.

Synopsis

int U_accept (int fd, int sec, int usec)

Parameters fd

: Socket descriptor

sec

: A maximum interval to wait for the connection in second

usec

: A maximum interval to wait for the connection in micro
second

Returns

-1

: If the call fails

0

: Waiting but timeout

n

: A socket descriptor if successful

83

Advertising