[Overview][Constants][Types][Procedures and functions][Index] | Reference for unit 'Sockets' (#rtl)

# fprecv

Receive data on socket

## Declaration

Source position: socketsh.inc line 157

`function fprecv(`
`s: cint;`
`buf: pointer;`
`len: size_t;`
`flags: cint`
`):ssize_t;`

## Description

fpRecv reads at most len bytes from socket S into address buf. The socket must be in a connected state. Flags can be one of the following:

1
  Process out-of band data.
4
  Bypass routing, use a direct interface.
??
  Wait for full request or report an error.

The functions returns the number of bytes actually read from the socket, or -1 if a detectable error occurred.

## Errors

Errors are reported in SocketError, and include the following:

ESockEBADF
  The socket descriptor is invalid.
ESockENOTCONN
  The socket isn't connected.
ESockENOTSOCK
  The descriptor is not a socket.
ESockEFAULT
  The address is outside your address space.
ESockEMSGSIZE
  The message cannot be sent atomically.
ESockEWOULDBLOCK
  The requested operation would block the process.
ESockENOBUFS
  The system doesn't have enough free buffers available.

## See also

FPSend |  | Send data through socket