sys_socket_recvfrom

Function sys_socket_recvfrom 

Source
pub fn sys_socket_recvfrom(tf: &mut Trapframe) -> usize
Expand description

System call: Receive datagram with sender address

Receives a datagram from a socket and returns the sender’s address. Used for UDP and Local datagram sockets.

§Arguments (via trapframe)

  • a0: Socket handle ID
  • a1: Pointer to buffer for receiving data
  • a2: Buffer length
  • a3: Pointer to SocketAddress structure for storing sender address (can be null)

§Returns

Number of bytes received on success, usize::MAX (-1) on error

§Errors

Returns usize::MAX (-1) if:

  • Invalid handle ID
  • Invalid buffer pointer
  • Socket error