| 1 | # modbus_get_socket |
| 2 | |
| 3 | ## Name |
| 4 | |
| 5 | modbus_get_socket - get the current socket of the context |
| 6 | |
| 7 | ## Synopsis |
| 8 | |
| 9 | ```c |
| 10 | int modbus_get_socket(modbus_t *ctx); |
| 11 | ``` |
| 12 | |
| 13 | ## Description |
| 14 | |
| 15 | The *modbus_get_socket()* function shall return the current socket or file |
| 16 | descriptor of the libmodbus context. |
| 17 | |
| 18 | ## Return value |
| 19 | |
| 20 | The function returns the current socket or file descriptor of the context if |
| 21 | successful. Otherwise it shall return -1 and set errno. |
| 22 | |
| 23 | ## See also |
| 24 | |
| 25 | - [modbus_set_socket](modbus_set_socket.md) |