---
name: "modbus_receive"
section: "3"
platform: "linux"
package: "libmodbus-dev"
version: "3.1.6-2.1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/modbus_receive"
---

# modbus\_receive(3)

receive an indication request

## NAME

modbus\_receive - receive an indication request

## SYNOPSIS

**int modbus\_receive(modbus\_t \****ctx***, uint8\_t \****req***);**

## DESCRIPTION

The **modbus\_receive()** function shall receive an indication request from the socket of the context *ctx*. This function is used by Modbus slave/server to receive and analyze indication request sent by the masters/clients.

If you need to use another socket or file descriptor than the one defined in the context *ctx*, see the function [**modbus\_set\_socket**(3)](/modbus_set_socket/3.md).

## RETURN VALUE

The function shall store the indication request in *req* and return the request length if successful. The returned request length can be zero if the indication request is ignored (eg. a query for another slave in RTU mode). Otherwise it shall return -1 and set errno.

## SEE ALSO

[**modbus\_set\_socket**(3)](/modbus_set_socket/3.md) [**modbus\_reply**(3)](/modbus_reply/3.md)

## AUTHORS

The libmodbus documentation was written by Stéphane Raimbault \<stephane.raimbault@gmail.com\>
