> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_net_read_packet.md).

# mysql\_net\_read\_packet

## Syntax

```bnf
#include <mysql.h>

unsigned long mysql_net_read_packet(MYSQL *mysql)
```

## Parameter

| Parameter | Description                                                                                                                                                                                                                                        |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mysql`   | A connection handle previously allocated by [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md) and connected by [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md). |

## Description

`mysql_net_read_packet` reads the next protocol packet from the server into the connection's internal network buffer.

## Return Value

Returns the length of the received packet.

{% hint style="info" %}
This function is part of the low level protocol API.
{% endhint %}

## See also

* [`mysql_net_field_length()`](/docs/connectors/mariadb-connector-c/api-functions/mysql_net_field_length.md)
