@CHIP-RTOS C Library - TCP/IP API
recv_bsd
Receive data from TCP socket. int far recv_bsd ( int sd,
char far * bufptr,
int buflen,
int flags,
unsigned long timeout ) ; Parameters
sd
- Socket descriptor
bufptr
- Output Parameter: Received data will be put here.
buflen
- Maximum bytes to write to the buffer at
bufptr
.
flags
- Control flags: Either MSG_BLOCKING or MSG_DONTWAIT.
timeout
- Maximum wait time in milliseconds. Set to
zero to wait forever.
Return Value
- > 0: Number of data bytes placed at bufptr
.
-1: Failure, error code is available using
get_socketerror().
Comments
- This API function applies only to TCP sockets.
It receives a message from another socket.
This API function may be used only if the socket is in a
connected state.
If flags
parameter is set to MSG_DONTWAIT, this API call returns
immediately. If no data is available -1 is returned and
get_socketerror() will report
error code 235 in this case.
If flags
parameter is set to MSG_BLOCKING, the recv
call waits for either a message to arrive or a socket error condition
to occur (such as connection lost or socket closed).
By default the blocking mode is set for all sockets at the
opensocket() call. If however
the socket was subsequently set to non-blocking mode with the
Set_Blocking_Mode() API,
the MSG_BLOCKING flag will then not work here.
If the compilation switch
#define BSD44_SOCKET_API_STYLE
is set as a global define in the user application prior to including the
Beck C-library header files, the recv()
call can be used in
BSD 4.4 compatible style with the parameters specified above.
Using this switch the CLIB TCPIP_Socket.H redefines recv()
to recv_bsd()
.
See Also
RTOS API
- On the first call, this library function invokes a software
interrupt
which modifies the code at the calling site inside your application
program. A direct FAR JMP into the @CHIP-RTOS-x86
implementation for this function is installed so that on
return and on any subsequent calls to this API this
dynamic link reaches the function's
implementation directly.
Supported since or modified in @CHIP-RTOS version-
| SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
| n/a | n/a | n/a | V1.36 | V1.36 |
Supported by @CHIP-RTOS C Library since version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|