If a packet that is larger than max_allowed_packet (a server-defined variable) is sent, the server will reset the connection and send an error packet with the response Got a packet bigger than 'max_allowed_packet' bytes. However, once this happens the connection is destroyed and the client can't recover.
Additionally, it's a waste of time to send the query to the server when we know it'll be rejected. By running SHOW VARIABLES when the connection is established, we could get the value of max_allowed_packet, and check packets to ensure they don't exceed that length before sending them.
If a packet that is larger than
max_allowed_packet(a server-defined variable) is sent, the server will reset the connection and send an error packet with the responseGot a packet bigger than 'max_allowed_packet' bytes. However, once this happens the connection is destroyed and the client can't recover.Additionally, it's a waste of time to send the query to the server when we know it'll be rejected. By running
SHOW VARIABLESwhen the connection is established, we could get the value ofmax_allowed_packet, and check packets to ensure they don't exceed that length before sending them.