this is my C++ code:
bool slave::request_dump(){
int binlog_filename_len=binlog_filename.length();
ssize_t res;
struct _COM_binlog_DUMP
{
unsigned char cmd;
unsigned char binlog_pos[4];
unsigned char flags[2];
unsigned char serverid[4];
} COM_binlog_DUMP;
MYSQL_PACKET_HEADER mph = { 0 };
mph.plen = 11 + binlog_filename_len;
mph.psid = 0;
COM_binlog_DUMP.cmd = 0x12;
memcpy(COM_binlog_DUMP.serverid,&serverid, sizeof(COM_binlog_DUMP.serverid));
COM_binlog_DUMP.flags[0] = 0x00;
COM_binlog_DUMP.flags[1] = 0x00;
memcpy(COM_binlog_DUMP.binlog_pos,&binlog_pos, sizeof(COM_binlog_DUMP.binlog_pos));
unsigned char packet[sizeof(mph)+sizeof(COM_binlog_DUMP)+binlog_filename_len];
memcpy(packet,&mph, sizeof(mph));
memcpy(packet+sizeof(mph),&COM_binlog_DUMP,sizeof(COM_binlog_DUMP));
memcpy(packet+sizeof(mph)+sizeof(COM_binlog_DUMP),binlog_filename.c_str(),binlog_filename_len);
res = write(this->mysql.net.fd, packet, sizeof(packet));
if ( res == (15 + binlog_filename_len) ) {
return 1;
} else {
return 0;
}
}
this is the information I got from wireshark. the packet was rejected and determined as ignored unknow record by mysql.
0000 00 0c 29 93 09 eb 00 0c 29 d7 b0 64 08 00 45 00 ..).....)..d..E.
0010 00 53 5d f3 40 00 40 06 e6 56 c0 a8 3a 87 c0 a8 .S].@.@..V..:...
0020 3a 83 96 c0 0c ea 7b 30 17 d7 4a 9d 54 84 80 18 :.....{0..J.T...
0030 01 f5 de fa 00 00 01 01 08 0a f3 e8 cd 78 a4 2d .............x.-
0040 ee b8 1b 00 00 00 12 9a 00 00 00 00 00 e7 03 00 ................
0050 00 6d 79 73 71 6c 2d 62 69 6e 2e 30 30 30 30 30 .mysql-bin.00000
0060 33 3
is there anyone can help me? thanks in advance.
Aucun commentaire:
Enregistrer un commentaire