| 1 | # modbus_get_slave |
| 2 | |
| 3 | ## Name |
| 4 | |
| 5 | modbus_get_slave - get slave number in the context |
| 6 | |
| 7 | ## Synopsis |
| 8 | |
| 9 | ```c |
| 10 | int modbus_get_slave(modbus_t *ctx); |
| 11 | ``` |
| 12 | |
| 13 | ## Description |
| 14 | |
| 15 | The *modbus_get_slave()* function shall get the slave number in the libmodbus |
| 16 | context. |
| 17 | |
| 18 | ## Return value |
| 19 | |
| 20 | The function shall return the slave number if successful. Otherwise it shall |
| 21 | return -1 and set errno to one of the values defined below. |
| 22 | |
| 23 | ## Errors |
| 24 | |
| 25 | - *EINVAL*, the libmodbus context is undefined. |
| 26 | |
| 27 | ## See also |
| 28 | |
| 29 | - [modbus_set_slave](modbus_set_slave.md) |