Mysql Protocol ping command package and analysis details and instances, mysqlping

Source: Internet
Author: User

Mysql Protocol ping command package and analysis details and instances, mysqlping

Ping Command package of mysql protocol and Explanation

Preface:

The MySQL client can use the ping command to check the status of the server. Normally, an OK packet is returned.

Mysql communication packet structure

Type Name Description
Int <3> Payload length Stored according to the least significant byte first, 3 bytes of payload and 1 byte serial number are combined into the report Header
Int <1> Serial number
String Payload Style. The length is the payload length specified earlier.

Ping Command package

Payload

[0e] COM_PING

More details: http://dev.mysql.com/doc/internals/en/com-ping.html

Ping Command package

/** *  * @author seaboat * @date 2016-09-25 * @version 1.0 * <pre><b>email: </b>849586227@qq.com</pre> * <pre><b>blog: </b>http://blog.csdn.net/wangyangzhizhou</pre> * <p>ping command packet.</p> */public class PingPacket extends MySQLPacket {  // payload length is 1,packet id is 0,payload is 0e  public static final byte[] PING = new byte[] { 1, 0, 0, 0, 14 };  @Override  public int calcPacketSize() {    return 1;  }  @Override  protected String getPacketInfo() {    return "MySQL Ping Packet";  }}

Source code download: http://xiazai.jb51.net/201701/yuanma/mysql-protocol-master (jb51.netw..rar

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.