{"id":16938,"date":"2025-04-18T23:23:18","date_gmt":"2025-04-18T15:23:18","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/16938.html"},"modified":"2025-04-18T23:23:18","modified_gmt":"2025-04-18T15:23:18","slug":"%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b%e4%b9%8b%e5%ae%a2%e6%88%b7%e7%ab%af%e9%80%9a%e8%bf%87%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8e%e5%8f%a6%e5%a4%96%e4%b8%80%e4%b8%aa%e5%ae%a2%e6%88%b7%e7%ab%af%e4%ba%a4","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/16938.html","title":{"rendered":"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41"},"content":{"rendered":"<p>\u670d\u52a1\u5668\u4f7f\u7528select\u6a21\u578b\u642d\u5efa&#xff0c;\u5ba2\u6237\u7aef1\u4f7f\u7528\u7ebf\u7a0b\u642d\u5efa&#xff0c;\u5ba2\u6237\u7aef2\u4f7f\u7528poll\u6a21\u578b\u642d\u5efa&#xff0c;<\/p>\n<p>\u4f7f\u7528\u65f6\u9700\u8981\u5148\u8fd0\u884c\u670d\u52a1\u5668&#xff0c;\u5177\u4f53\u7f16\u8bd1\u53ef\u770b\u6211\u6700\u540e\u7684\u56fe\u7247<\/p>\n<\/p>\n<h2>\u00a0head.h\u5934\u6587\u4ef6<\/h2>\n<p>#ifndef __HEAD_H_ #define __HEAD_H_<\/p>\n<p>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;unistd.h&gt; #include &lt;sys\/types.h&gt; #include &lt;sys\/stat.h&gt; #include &lt;fcntl.h&gt; #include &lt;sys\/stat.h&gt; #include &lt;pwd.h&gt; #include &lt;dirent.h&gt; #include &lt;wait.h&gt; #include &lt;errno.h&gt; #include &lt;pthread.h&gt; #include &lt;semaphore.h&gt; #include &lt;sys\/ipc.h&gt; #include &lt;sys\/msg.h&gt; #include &lt;sys\/shm.h&gt; #include &lt;sys\/sem.h&gt; #include &lt;sys\/socket.h&gt; #include &lt;netinet\/in.h&gt; #include &lt;arpa\/inet.h&gt; \u00a0#include &lt;poll.h&gt; #include &lt;signal.h&gt; #define PRINTF_ERROR(a) {perror(a);return -1;} #endif<\/p>\n<\/p>\n<h2>\u00a0\u670d\u52a1\u5668\u642d\u5efa\u4ee3\u7801<\/h2>\n<h3>server_select.c<\/h3>\n<p>#include &lt;head.h&gt; enum Type{ \u00a0\u00a0\u00a0 TYPE_LOGIN, \u00a0\u00a0\u00a0 TYPE_REDIST }; typedef struct Pack{ \/\/\u534f\u8bae\u5305 \u00a0\u00a0\u00a0 int packsize; \u00a0\u00a0\u00a0 enum Type type; \u00a0\u00a0\u00a0 char buf[4096]; \u00a0\u00a0\u00a0 int used;<\/p>\n<p>}pack_t;\u00a0 \u00a0 void freeList(char** list){ \u00a0\u00a0\u00a0 for(int i&#061;0;list[i]!&#061;NULL;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 free(list[i]); \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 free(list); }<\/p>\n<p>char** analysis(pack_t pack){\u00a0 \u00a0 \u00a0\/\/\u89e3\u6790\u5ba2\u6237\u7aef\u53d1\u6765\u7684\u534f\u8bae\u5305 \u00a0\u00a0\u00a0 char* buf&#061;pack.buf; \u00a0\u00a0\u00a0 int readed_size&#061;0; \u00a0\u00a0\u00a0 char** list &#061; calloc(1,80); \u00a0\u00a0\u00a0 int i&#061;0;\/\/ \u00a0\u00a0\u00a0 while(1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 short size &#061; *(short*)(buf&#043;readed_size); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(size&#061;&#061;0) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readed_size&#043;&#061;2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char temp[size&#043;1]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 memset(temp,0,size&#043;1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 memcpy(temp,buf&#043;readed_size,size); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readed_size&#043;&#061;size;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 list[i]&#061;calloc(1,size&#043;1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 strcpy(list[i],temp); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i&#043;&#043;; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 return list;<\/p>\n<p>} void insert_client(int* arr,int client,int* len){ \/\/\u5c06\u5ba2\u6237\u7aef\u7684\u63cf\u8ff0\u7b26\u653e\u5165\u6570\u7ec4 \u00a0\u00a0\u00a0 arr[*len]&#061;client; \u00a0\u00a0\u00a0 (*len)&#043;&#043;; } void remove_client(int* arr,int client,int* len){ \u00a0\u00a0\u00a0 int i&#061;0,j&#061;0; \u00a0\u00a0\u00a0 for(i&#061;0;i&lt;*len;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(arr[i]&#061;&#061;client) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 if(i&#061;&#061;*len) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return; \u00a0\u00a0\u00a0 for(j&#061;i;j&lt;*len;j&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 arr[j]&#061;arr[j&#043;1]; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 arr[j]&#061;0; \u00a0\u00a0\u00a0 (*len&#8211;); } int main(int argc, const char *argv[]) { \u00a0\u00a0\u00a0 if(argc&lt;2){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u8bf7\u8f93\u5165\u7aef\u53e3\u53f7:\\\\n&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return 1; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 int port &#061; atoi(argv[1]); \u00a0\u00a0\u00a0 int server &#061; socket(AF_INET,SOCK_STREAM,0); \u00a0\u00a0\u00a0 struct sockaddr_in addr &#061; {0};<\/p>\n<p>\u00a0\u00a0\u00a0 addr.sin_family &#061; AF_INET; \u00a0\u00a0\u00a0 addr.sin_port &#061; htons(port); \u00a0\u00a0\u00a0 addr.sin_addr.s_addr &#061; inet_addr(&#034;0.0.0.0&#034;); \u00a0\u00a0\u00a0 if(bind(server,(struct sockaddr*)&amp;addr,sizeof(addr))&#061;&#061;-1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 perror(&#034;bind&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return -1; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 listen(server,50);<\/p>\n<p>\u00a0\u00a0\u00a0 int\u00a0 client_arr[64]&#061;{0};\/\/\u5b58\u653e\u6240\u6709\u5ba2\u6237\u7aef\u5957\u63a5\u5b57\u7684\u6570\u7ec4 \u00a0\u00a0\u00a0 int arr_len&#061;0;\/\/\u8bb0\u5f55\u6570\u7ec4\u7684\u957f\u5ea6 \u00a0\u00a0\u00a0 fd_set readfds;\/\/\u521b\u5efa\u4e00\u4e2aselect\u7684\u76d1\u542c\u5217\u8868 \u00a0\u00a0\u00a0 FD_ZERO(&amp;readfds);\/\/\u521d\u59cb\u5316\u76d1\u542c\u5217\u8868 \u00a0\u00a0\u00a0 FD_SET(server,&amp;readfds);\/\/\u5c06\u670d\u52a1\u5668\u5957\u63a5\u5b57\u653e\u5165\u76d1\u542c\u5217\u8868\u4e2d \u00a0\u00a0\u00a0 FD_SET(STDIN_FILENO,&amp;readfds);\/\/\u5c06\u6807\u51c6\u8f93\u5165\u6d41\u653e\u5165\u76d1\u542c\u5217\u8868\u4e2d<\/p>\n<\/p>\n<p>\u00a0\u00a0\u00a0 while(1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fd_set temp&#061;readfds; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 select(1024,&amp;temp,0,0,0); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(FD_ISSET(0,&amp;temp)){\u00a0 \u8f93\u5165\u6d41\u6fc0\u6d3b \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char buf[1024]&#061;&#034;&#034;; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 scanf(&#034;%s&#034;,buf); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 getchar(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u952e\u76d8\u8f93\u5165\u6570\u636e:%s\\\\n&#034;,buf); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(FD_ISSET(server,&amp;temp)){\u00a0 \u670d\u52a1\u5668\u6fc0\u6d3b \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int client&#061;accept(server,0,0); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u6709\u5ba2\u6237\u7aef\u94fe\u63a5\\\\n&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FD_SET(client,&amp;readfds); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 insert_client(client_arr,client,&amp;arr_len); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(int i&#061;0;i&lt;arr_len;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int client &#061; client_arr[i]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(FD_ISSET(client,&amp;temp)){ \/\/\u5ba2\u6237\u7aef\u6fc0\u6d3b<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack_t pack&#061;{0}; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int size&#061;0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int res&#061;read(client,&amp;size,4); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(res &#061;&#061;0){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u5ba2\u6237\u7aef\u65ad\u5f00\u94fe\u63a5\\\\n&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FD_CLR(client,&amp;readfds); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 remove_client(client_arr,client,&amp;arr_len); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 close(client); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack.packsize&#061;size; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read(client,(char*)&amp;pack&#043;4,size-4); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char** list&#061;analysis(pack); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(int j&#061;0;j&lt;arr_len;j&#043;&#043;){\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(client_arr[i]!&#061;client_arr[j]){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(write(client_arr[j],&amp;pack,size)&lt;&#061;0) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PRINTF_ERROR(&#034;write error&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;%s\\\\n&#034;,list[0]); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 freeList(list);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 return 0; }<\/p>\n<h2>\u00a0\u5ba2\u6237\u7aef1<\/h2>\n<h3>client1.c<\/h3>\n<p>#include &lt;head.h&gt; #include &lt;pthread.h&gt; enum Type{ \u00a0\u00a0\u00a0 TYPE_REGIST, \u00a0\u00a0\u00a0 TYPE_LOGIN };<\/p>\n<p>typedef struct Pack{ \u00a0\u00a0\u00a0 int packsize; \u00a0\u00a0\u00a0 enum Type type; \u00a0\u00a0\u00a0 char buf[4096]; \u00a0\u00a0\u00a0 int used; }pack_t;<\/p>\n<p>void append(pack_t* pack,const char* str){ \u00a0\u00a0\u00a0 char* buf&#061;pack-&gt;buf; \u00a0\u00a0\u00a0 short size&#061;strlen(str); \u00a0\u00a0\u00a0 *(short*)(buf&#043;pack-&gt;used)&#061;size; \u00a0\u00a0\u00a0 pack-&gt;used&#043;&#061;2; \u00a0\u00a0\u00a0 memcpy(buf&#043;pack-&gt;used,str,size); \u00a0\u00a0\u00a0 pack-&gt;used&#043;&#061;size; \u00a0\u00a0\u00a0 pack-&gt;packsize&#061;pack-&gt;used&#043;8; } void freeList(char** list){ \u00a0\u00a0\u00a0 for(int i&#061;0;list[i]!&#061;NULL;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 free(list[i]); \u00a0\u00a0\u00a0 }\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 free(list); }<\/p>\n<p>char** analysis(pack_t pack){ \u00a0\u00a0\u00a0 char* buf&#061;pack.buf; \u00a0\u00a0\u00a0 int readed_size&#061;0; \u00a0\u00a0\u00a0 char** list &#061; calloc(1,80); \u00a0\u00a0\u00a0 int i&#061;0;\/\/ \u00a0\u00a0\u00a0 while(1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 short size &#061; *(short*)(buf&#043;readed_size); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(size&#061;&#061;0) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readed_size&#043;&#061;2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char temp[size&#043;1]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 memset(temp,0,size&#043;1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 memcpy(temp,buf&#043;readed_size,size); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readed_size&#043;&#061;size;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 list[i]&#061;calloc(1,size&#043;1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 strcpy(list[i],temp); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i&#043;&#043;; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 return list;<\/p>\n<p>}<\/p>\n<p> void* Write(void* arg){ \u00a0\u00a0\u00a0 int client &#061;*(int *)arg; \u00a0\u00a0\u00a0 while(1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char str[20]&#061;&#034;&#034;; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack_t pack&#061;{0}; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack.type&#061;TYPE_REGIST; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 scanf(&#034;%19s&#034;,str); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 getchar(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 append(&amp;pack,str); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 write(client,&amp;pack,pack.packsize); \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 pthread_exit(NULL);<\/p>\n<p>} void* Read(void* arg){ \u00a0\u00a0\u00a0 int client &#061;*(int *)arg; \u00a0\u00a0\u00a0 while(1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack_t pack1&#061;{0}; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int size&#061;0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read(client,&amp;size,4); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read(client,(char*)&amp;pack1&#043;4,size-4); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char** list&#061;analysis(pack1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u5ba2\u6237\u7aef1:%s\\\\n&#034;,list[0]); \u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 freeList(list);<\/p>\n<p> \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 pthread_exit(NULL); } int main(int argc, const char *argv[]) { \u00a0\u00a0\u00a0 if(argc&lt;2){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u8bf7\u8f93\u5165\u7aef\u53e3\u53f7\\\\n&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return -1; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 int port&#061;atoi(argv[1]); \u00a0\u00a0\u00a0 int client&#061;socket(AF_INET,SOCK_STREAM,0);<\/p>\n<p>\u00a0\u00a0\u00a0 struct sockaddr_in addr&#061;{0}; \u00a0\u00a0\u00a0 addr.sin_family&#061;AF_INET; \u00a0\u00a0\u00a0 addr.sin_port&#061;htons(port); \u00a0\u00a0\u00a0 addr.sin_addr.s_addr&#061;inet_addr(&#034;0.0.0.0&#034;); \u00a0\u00a0\u00a0 if(connect(client,(struct sockaddr*)&amp;addr,sizeof(addr))&#061;&#061;-1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PRINTF_ERROR(&#034;bind error&#034;); \u00a0\u00a0\u00a0 }<\/p>\n<\/p>\n<p>\u00a0\u00a0\u00a0 pthread_t tid1,tid2; \u00a0\u00a0\u00a0 pthread_create(&amp;tid1,NULL,Write,&amp;client); \u00a0\u00a0\u00a0 pthread_create(&amp;tid2,NULL,Read,&amp;client); \u00a0\u00a0\u00a0 pthread_join(tid1,NULL); \u00a0\u00a0\u00a0 pthread_join(tid2,NULL);<\/p>\n<\/p>\n<p> \u00a0\u00a0\u00a0 return 0; }<\/p>\n<h2>\u5ba2\u6237\u7aef2<\/h2>\n<h3>client2.c<\/h3>\n<p>#include &lt;head.h&gt; enum Type{ \u00a0\u00a0\u00a0 TYPE_LOGIN, \u00a0\u00a0\u00a0 TYPE_REDIST }; typedef struct Pack{ \u00a0\u00a0\u00a0 int packsize; \u00a0\u00a0\u00a0 enum Type type; \u00a0\u00a0\u00a0 char buf[4096]; \u00a0\u00a0\u00a0 int used;<\/p>\n<p>}pack_t; void append(pack_t* pack,const char* str){ \u00a0\u00a0\u00a0 char* buf &#061; pack-&gt;buf; \u00a0\u00a0\u00a0 short size &#061; strlen(str); \u00a0\u00a0\u00a0 *(short*)(buf&#043;pack-&gt;used) &#061; size; \u00a0\u00a0\u00a0 pack-&gt;used &#043;&#061;2; \u00a0\u00a0\u00a0 memcpy(buf&#043;pack-&gt;used,str,size); \u00a0\u00a0\u00a0 pack-&gt;used&#043;&#061;size; \u00a0\u00a0\u00a0 pack-&gt;packsize&#061;pack-&gt;used&#043;8; } \/\/ \u8be5\u51fd\u6570\u529f\u80fd\u4e3a&#xff1a;\u5c06client\u5b58\u5165\u6570\u7ec4arr\u4e2d\u7684\u6700\u540e\u4e00\u4e2a\u4e0b\u6807\u4f4d\u7f6e\u4e0a&#xff0c;\u5b58\u5b8c\u4e4b\u540e&#xff0c;arr\u6570\u7ec4\u7684\u957f\u5ea6\u8bb0\u5f97\u81ea\u589e void insert_client(struct pollfd* arr,struct pollfd client,int* len){ \u00a0\u00a0\u00a0 arr[*len] &#061; client; \u00a0\u00a0\u00a0 (*len)&#043;&#043;; }<\/p>\n<p>\/\/ \u5c06client\u4ece\u6570\u7ec4arr\u4e2d\u79fb\u9664&#xff0c;\u79fb\u9664\u540e\u8bb0\u5f97\u6570\u7ec4\u957f\u5ea6-1 void remove_client(struct pollfd* arr,int client,int* len){ \u00a0\u00a0\u00a0 int i &#061; 0,j &#061; 0; \u00a0\u00a0\u00a0 for(i&#061;0;i&lt;*len;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(arr[i].fd &#061;&#061; client){break;} \u00a0\u00a0\u00a0 }\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 if(i &#061;&#061; *len){return;} \u00a0\u00a0\u00a0 for(j&#061;i;j&lt;*len-1;j&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 arr[j] &#061; arr[j&#043;1]; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 \/\/arr[j] &#061; 0; \u00a0\u00a0\u00a0 (*len)&#8211;; } void freeList(char** list){ \u00a0\u00a0\u00a0 for(int i&#061;0;list[i]!&#061;NULL;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 free(list[i]); \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 free(list); }<\/p>\n<p>char** analysis(pack_t pack){ \u00a0\u00a0\u00a0 char* buf&#061;pack.buf; \u00a0\u00a0\u00a0 int readed_size&#061;0; \u00a0\u00a0\u00a0 char** list &#061; calloc(1,80); \u00a0\u00a0\u00a0 int i&#061;0;\/\/ \u00a0\u00a0\u00a0 while(1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 short size &#061; *(short*)(buf&#043;readed_size); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(size&#061;&#061;0) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readed_size&#043;&#061;2; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char temp[size&#043;1]; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 memset(temp,0,size&#043;1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 memcpy(temp,buf&#043;readed_size,size); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readed_size&#043;&#061;size;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 list[i]&#061;calloc(1,size&#043;1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 strcpy(list[i],temp); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i&#043;&#043;; \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 return list;<\/p>\n<p>}<\/p>\n<p>int main(int argc, const char *argv[]) { \u00a0\u00a0\u00a0 if(argc&lt;2){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u8bf7\u8f93\u5165\u7aef\u53e3\u53f7:\\\\n&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return 1;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 int port &#061; atoi(argv[1]);<\/p>\n<p>\u00a0\u00a0\u00a0 int client &#061; socket(AF_INET,SOCK_STREAM,0); \u00a0\u00a0\u00a0 struct sockaddr_in addr &#061; {0}; \u00a0\u00a0\u00a0 addr.sin_family &#061; AF_INET; \u00a0\u00a0\u00a0 addr.sin_port &#061; htons(port); \u00a0\u00a0\u00a0 addr.sin_addr.s_addr &#061; inet_addr(&#034;0.0.0.0&#034;); \u00a0\u00a0\u00a0 if(connect(client,(struct sockaddr*)&amp;addr,sizeof(addr))&#061;&#061;-1){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 perror(&#034;connect&#034;); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return -1; \u00a0\u00a0\u00a0 }<\/p>\n<p>\u00a0\u00a0\u00a0 struct pollfd list[50]&#061;{0}; \u00a0\u00a0\u00a0 int list_len&#061;0; \u00a0\u00a0\u00a0 struct pollfd client_fd&#061;{fd:client,events:POLLIN,revents:0}; \u00a0\u00a0\u00a0 struct pollfd stdin_fd&#061;{fd:0,events:POLLIN,revents:0};<\/p>\n<p>\u00a0\u00a0\u00a0 insert_client(list,client_fd,&amp;list_len);<\/p>\n<p>\u00a0\u00a0\u00a0 insert_client(list,stdin_fd,&amp;list_len);<\/p>\n<p> \u00a0\u00a0\u00a0 while(1){<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 poll(list,list_len,-1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int i&#061;0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(i&#061;0;i&lt;list_len;i&#043;&#043;){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(list[i].revents&#061;&#061;0){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 continue; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int fd&#061;list[i].fd; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if(fd&#061;&#061;0){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char str[20]&#061;&#034;&#034;; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack_t pack &#061; {0}; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack.type&#061;TYPE_REDIST; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 scanf(&#034;%19s&#034;,str); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 getchar(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 append(&amp;pack,str); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 write(client,&amp;pack,pack.packsize); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }else{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pack_t pack1&#061;{0}; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int size&#061;0; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read(client,&amp;size,4); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read(client,(char*)&amp;pack1&#043;4,size-4); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 char** list&#061;analysis(pack1); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 printf(&#034;\u5ba2\u6237\u7aef2&#xff1a;%s\\\\n&#034;,list[0]); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 freeList(list);<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0 }<\/p>\n<p>\u00a0\u00a0\u00a0 return 0; }<\/p>\n<h2>\u00a0\u7ed3\u679c<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"777\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418152317-68026e653fa16.png\" width=\"676\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb856\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u670d\u52a1\u5668\u5ba2\u6237\u7aef<\/p>\n","protected":false},"author":2,"featured_media":16937,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[43,78,44],"topic":[],"class_list":["post-16938","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-43","tag-78","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/16938.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb856\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u670d\u52a1\u5668\u5ba2\u6237\u7aef\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/16938.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T15:23:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418152317-68026e653fa16.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16938.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/16938.html\",\"name\":\"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:23:18+00:00\",\"dateModified\":\"2025-04-18T15:23:18+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/16938.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/16938.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16938.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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":"https:\/\/www.wsisp.com\/helps\/16938.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb856\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u670d\u52a1\u5668\u5ba2\u6237\u7aef","og_url":"https:\/\/www.wsisp.com\/helps\/16938.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:23:18+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418152317-68026e653fa16.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/16938.html","url":"https:\/\/www.wsisp.com\/helps\/16938.html","name":"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:23:18+00:00","dateModified":"2025-04-18T15:23:18+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/16938.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/16938.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/16938.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7f51\u7edc\u7f16\u7a0b\u4e4b\u5ba2\u6237\u7aef\u901a\u8fc7\u670d\u52a1\u5668\u4e0e\u53e6\u5916\u4e00\u4e2a\u5ba2\u6237\u7aef\u4ea4\u6d41"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=16938"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16938\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/16937"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=16938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=16938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=16938"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=16938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}