{"id":50307,"date":"2025-07-30T22:51:50","date_gmt":"2025-07-30T14:51:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/50307.html"},"modified":"2025-07-30T22:51:50","modified_gmt":"2025-07-30T14:51:50","slug":"%e5%a4%9a%e5%ae%a2%e6%88%b7%e7%ab%af-%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%88select%ef%bc%8cpoll%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/50307.html","title":{"rendered":"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"2148\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730145144-688a31805e7ad.png\" width=\"3252\" \/><\/p>\n<h2>\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\u7ed3\u6784\u603b\u7ed3<\/h2>\n<h3>\u4e00\u3001\u666e\u901aCS\u67b6\u6784\u7684\u5c40\u9650\u6027<\/h3>\n<ul>\n<li>\u6838\u5fc3\u95ee\u9898&#xff1a;\u5355\u7ebf\u7a0b\u4e2daccept&#xff08;\u963b\u585e\u7b49\u5f85\u8fde\u63a5&#xff09;\u4e0eread&#xff08;\u963b\u585e\u8bfb\u53d6\u6570\u636e&#xff09;\u51fd\u6570\u4e92\u76f8\u5e72\u6270&#xff0c;\u65e0\u6cd5\u540c\u65f6\u5904\u7406\u591a\u5ba2\u6237\u7aef\u3002<\/li>\n<li>\u672c\u8d28\u539f\u56e0&#xff1a;\u963b\u585e\u578b\u51fd\u6570\u9700\u72ec\u7acb\u6267\u884c&#xff0c;\u82e5\u987a\u5e8f\u8c03\u7528\u4f1a\u5bfc\u81f4\u6d41\u7a0b\u505c\u6ede&#xff08;\u5982\u5148\u6267\u884caccept\u4f1a\u963b\u585e\u540e\u7eedread&#xff0c;\u53cd\u4e4b\u4ea6\u7136&#xff09;\u3002<\/li>\n<\/ul>\n<h3>\u4e8c\u3001\u591a\u7ebf\u7a0b\u4e0e\u591a\u8fdb\u7a0b\u89e3\u51b3\u65b9\u6848<\/h3>\n<h4>1. \u591a\u7ebf\u7a0b\u670d\u52a1\u5668<\/h4>\n<ul>\n<li>\u539f\u7406&#xff1a;\u4e3a\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5\u521b\u5efa\u72ec\u7acb\u7ebf\u7a0b&#xff0c;\u4e3b\u7ebf\u7a0b\u8d1f\u8d23\u76d1\u542c\u8fde\u63a5&#xff0c;\u5b50\u7ebf\u7a0b\u5904\u7406\u5ba2\u6237\u7aef\u6570\u636e\u4ea4\u4e92\u3002<\/li>\n<li>\u4f18\u52bf&#xff1a;\u907f\u514d\u4e3b\u7ebf\u7a0b\u963b\u585e&#xff0c;\u53ef\u540c\u65f6\u7ef4\u62a4\u591a\u4e2a\u5ba2\u6237\u7aef\u3002<\/li>\n<\/ul>\n<h4>2. \u591a\u8fdb\u7a0b\u670d\u52a1\u5668<\/h4>\n<ul>\n<li>\u539f\u7406&#xff1a;\u4e0e\u591a\u7ebf\u7a0b\u7c7b\u4f3c&#xff0c;\u901a\u8fc7\u521b\u5efa\u65b0\u8fdb\u7a0b\u7ef4\u62a4\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5&#xff0c;\u8fdb\u7a0b\u95f4\u8d44\u6e90\u72ec\u7acb\u3002<\/li>\n<li>\u4f18\u52bf&#xff1a;\u8fdb\u7a0b\u9694\u79bb\u6027\u5f3a&#xff0c;\u5355\u4e2a\u8fdb\u7a0b\u5d29\u6e83\u4e0d\u5f71\u54cd\u6574\u4f53\u670d\u52a1\u3002<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u591a\u8defIO\u590d\u7528\u6280\u672f<\/h3>\n<h4>1. \u6838\u5fc3\u76ee\u6807<\/h4>\n<ul>\n<li>\u5728\u5355\u7ebf\u7a0b\u4e2d\u9ad8\u6548\u5904\u7406\u591a\u4e2a\u963b\u585eIO\u64cd\u4f5c&#xff08;\u5982read\u3001accept&#xff09;&#xff0c;\u5b9e\u73b0\u63cf\u8ff0\u7b26\u95f4\u65e0\u5e72\u6270\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<h4>2. \u5de5\u4f5c\u673a\u5236<\/h4>\n<ul>\n<li>\u76d1\u89c6\u5217\u8868&#xff1a;\u7528\u6237\u624b\u52a8\u6dfb\u52a0\u9700\u76d1\u63a7\u7684\u5957\u63a5\u5b57\/\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002<\/li>\n<li>\u6fc0\u6d3b\u5217\u8868&#xff1a;\u7cfb\u7edf\u81ea\u52a8\u8bc6\u522b\u5e76\u8bb0\u5f55\u201c\u53ef\u8bfb\/\u53ef\u5199\u201d\u7684\u63cf\u8ff0\u7b26&#xff0c;\u7528\u6237\u4ec5\u9700\u5904\u7406\u6fc0\u6d3b\u7684\u63cf\u8ff0\u7b26&#xff0c;\u907f\u514d\u963b\u585e\u3002<\/li>\n<\/ul>\n<h3>\u56db\u3001select\u6a21\u578b\u8be6\u89e3<\/h3>\n<h4>1. \u6838\u5fc3\u7ed3\u6784<\/h4>\n<ul>\n<li>\u76d1\u89c6\u5217\u8868\u7c7b\u578b&#xff1a;fd_set&#xff08;\u672c\u8d28\u4e3a\u6808\u7a7a\u95f4\u6570\u7ec4&#xff0c;\u5bb9\u91cf\u56fa\u5b9a\u4e14\u65e0\u6cd5\u52a8\u6001\u6269\u5bb9&#xff09;\u3002<\/li>\n<li>\u6838\u5fc3\u64cd\u4f5c\u51fd\u6570&#xff1a;\n<ul>\n<li>FD_SET(fd, &amp;set)&#xff1a;\u6dfb\u52a0\u63cf\u8ff0\u7b26\u5230\u76d1\u89c6\u5217\u8868\u3002<\/li>\n<li>FD_CLR(fd, &amp;set)&#xff1a;\u4ece\u5217\u8868\u79fb\u9664\u63cf\u8ff0\u7b26\u3002<\/li>\n<li>FD_ISSET(fd, &amp;set)&#xff1a;\u5224\u65ad\u63cf\u8ff0\u7b26\u662f\u5426\u6fc0\u6d3b\u3002<\/li>\n<li>FD_ZERO(&amp;set)&#xff1a;\u521d\u59cb\u5316\u5217\u8868\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2. \u76d1\u89c6\u51fd\u6570select<\/h4>\n<p>int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);<\/p>\n<ul>\n<li>\u53c2\u6570&#xff1a;\n<ul>\n<li>nfds&#xff1a;\u6700\u5927\u63cf\u8ff0\u7b26\u503c&#043;1\u3002<\/li>\n<li>readfds\/writefds\/exceptfds&#xff1a;\u5206\u522b\u76d1\u89c6\u201c\u53ef\u8bfb\/\u53ef\u5199\/\u5f02\u5e38\u201d\u4e8b\u4ef6\u7684\u5217\u8868\u3002<\/li>\n<li>timeout&#xff1a;\u963b\u585e\u8d85\u65f6\u65f6\u95f4&#xff08;NULL\u8868\u793a\u6c38\u4e45\u963b\u585e&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u7279\u70b9&#xff1a;\u76d1\u89c6\u5217\u8868\u4e0e\u6fc0\u6d3b\u5217\u8868\u5171\u7528\u540c\u4e00\u5757\u5185\u5b58&#xff0c;\u6fc0\u6d3b\u540e\u4f1a\u8986\u76d6\u539f\u5217\u8868&#xff0c;\u9700\u624b\u52a8\u5907\u4efd\u3002<\/li>\n<\/ul>\n<h4>3. \u4f18\u7f3a\u70b9<\/h4>\n<ul>\n<li>\u4f18\u70b9&#xff1a;\u903b\u8f91\u7b80\u5355\u76f4\u89c2&#xff0c;\u6613\u4e8e\u5b9e\u73b0\u3002<\/li>\n<li>\u7f3a\u70b9&#xff1a;\n<ul>\n<li>\u76d1\u89c6\u5217\u8868\u5bb9\u91cf\u56fa\u5b9a&#xff0c;\u65e0\u6cd5\u52a8\u6001\u6269\u5bb9\u3002<\/li>\n<li>\u9700\u989d\u5916\u7ef4\u62a4\u63cf\u8ff0\u7b26\u6570\u7ec4&#xff0c;\u904d\u5386\u6548\u7387\u4f4e&#xff08;\u53cc\u91cd\u5faa\u73af&#xff09;\u3002<\/li>\n<li>\u6bcf\u6b21\u8c03\u7528\u9700\u590d\u5236\u5217\u8868&#xff0c;\u6d6a\u8d39\u7cfb\u7edf\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u4e94\u3001poll\u6a21\u578b\u8be6\u89e3<\/h3>\n<h4>1. \u6838\u5fc3\u7ed3\u6784<\/h4>\n<ul>\n<li>\u76d1\u89c6\u5217\u8868\u7c7b\u578b&#xff1a;struct pollfd\u6570\u7ec4&#xff08;\u53ef\u52a8\u6001\u6269\u5bb9&#xff0c;\u6808\/\u5806\u7a7a\u95f4\u5747\u53ef&#xff09;\u3002<br \/>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td>struct pollfd {<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>int fd; \/\/ \u76ee\u6807\u63cf\u8ff0\u7b26<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>short events; \/\/ \u76d1\u63a7\u4e8b\u4ef6&#xff08;\u5982POLLIN&#061;\u53ef\u8bfb&#xff0c;POLLOUT&#061;\u53ef\u5199&#xff09;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>short revents; \/\/ \u6fc0\u6d3b\u4e8b\u4ef6&#xff08;0&#061;\u672a\u6fc0\u6d3b&#xff0c;POLLIN\/POLLOUT&#061;\u5bf9\u5e94\u4e8b\u4ef6\u6fc0\u6d3b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>};<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ul>\n<h4>2. \u76d1\u89c6\u51fd\u6570poll<\/h4>\n<p>int poll(struct pollfd *fds, nfds_t nfds, int timeout);<\/p>\n<ul>\n<li>\u53c2\u6570&#xff1a;\n<ul>\n<li>fds&#xff1a;struct pollfd\u6570\u7ec4&#xff08;\u540c\u65f6\u4f5c\u4e3a\u76d1\u89c6\u5217\u8868\u548c\u6fc0\u6d3b\u5217\u8868&#xff09;\u3002<\/li>\n<li>nfds&#xff1a;\u6570\u7ec4\u957f\u5ea6&#xff08;\u7528\u6237\u81ea\u884c\u7ba1\u7406&#xff09;\u3002<\/li>\n<li>timeout&#xff1a;\u8d85\u65f6\u65f6\u95f4&#xff08;\u6beb\u79d2&#xff0c;-1&#061;\u6c38\u4e45\u963b\u585e&#xff0c;0&#061;\u975e\u963b\u585e&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u7279\u70b9&#xff1a;\u6fc0\u6d3b\u4e8b\u4ef6\u901a\u8fc7revents\u6807\u8bb0&#xff0c;\u4e0d\u4f1a\u8986\u76d6\u539f\u5217\u8868&#xff0c;\u65e0\u9700\u989d\u5916\u5907\u4efd\u3002<\/li>\n<\/ul>\n<h4>3. \u4f18\u7f3a\u70b9<\/h4>\n<ul>\n<li>\u4f18\u70b9&#xff1a;\n<ul>\n<li>\u76d1\u89c6\u5217\u8868\u53ef\u52a8\u6001\u6269\u5bb9&#xff0c;\u7075\u6d3b\u6027\u9ad8\u3002<\/li>\n<li>\u65e0\u9700\u53cd\u590d\u590d\u5236\u5217\u8868&#xff0c;\u8d44\u6e90\u5f00\u9500\u4f4e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u4ecd\u9700\u904d\u5386\u6574\u4e2a\u5217\u8868\u5224\u65ad\u6fc0\u6d3b\u72b6\u6001&#xff0c;\u6548\u7387\u8f83\u4f4e&#xff08;\u672a\u89e3\u51b3select\u7684\u904d\u5386\u95ee\u9898&#xff09;\u3002<\/li>\n<\/ul>\n<h3>\u516d\u3001\u4f5c\u4e1a\u8981\u6c42<\/h3>\n<h4>1. \u670d\u52a1\u5668\u7aef<\/h4>\n<ul>\n<li>\u4f7f\u7528select\u6a21\u578b\u5b9e\u73b0&#xff1a;\n<ul>\n<li>\u63a5\u53d7\u591a\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5\u3002<\/li>\n<li>\u8f6c\u53d1\u5ba2\u6237\u7aef\u95f4\u7684\u804a\u5929\u6d88\u606f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2. \u5ba2\u6237\u7aef<\/h4>\n<ul>\n<li>\u4f7f\u7528poll\u6a21\u578b\u5b9e\u73b0&#xff1a;\n<ul>\n<li>\u540c\u65f6\u5904\u7406\u201c\u8bfb\u53d6\u670d\u52a1\u5668\u6d88\u606f\u201d&#xff08;read&#xff09;\u548c\u201c\u952e\u76d8\u8f93\u5165\u201d&#xff08;scanf&#xff09;\u3002<\/li>\n<li>\u9650\u5236&#xff1a;\u4e0d\u5141\u8bb8\u5f00\u542f\u989d\u5916\u7ebf\u7a0b\u6216\u8fdb\u7a0b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>hesd.h<\/li>\n<\/ul>\n<p>#ifndef HEAD_H<br \/>\n#define HEAD_H<\/p>\n<p>#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\/socket.h&gt;<br \/>\n#include &lt;arpa\/inet.h&gt;<br \/>\n#include &lt;sys\/time.h&gt;<br \/>\n#include &lt;sys\/types.h&gt;<br \/>\n#include &lt;poll.h&gt;<\/p>\n<p>#define PORT 8888        \/\/ \u670d\u52a1\u5668\u7aef\u53e3<br \/>\n#define MAX_CLIENTS 10   \/\/ \u6700\u5927\u5ba2\u6237\u7aef\u6570<br \/>\n#define BUF_SIZE 1024    \/\/ \u6d88\u606f\u7f13\u51b2\u533a\u5927\u5c0f<\/p>\n<p>\/\/ \u5ba2\u6237\u7aef\u6570\u7ec4\u64cd\u4f5c\u51fd\u6570\u58f0\u660e<br \/>\nvoid insert_client(int arr[], int newclient, int* len);<br \/>\nvoid remove_client(int arr[], int client, int* len);<\/p>\n<p>#endif<\/p>\n<p>server.c<\/p>\n<p>#include &#034;head.h&#034;<\/p>\n<p>\/\/ \u6dfb\u52a0\u65b0\u5ba2\u6237\u7aef\u5230\u6570\u7ec4<br \/>\nvoid insert_client(int arr[], int newclient, int* len) {<br \/>\n    arr[*len] &#061; newclient;<br \/>\n    (*len)&#043;&#043;;<br \/>\n}<\/p>\n<p>\/\/ \u4ece\u6570\u7ec4\u4e2d\u79fb\u9664\u5ba2\u6237\u7aef<br \/>\nvoid remove_client(int arr[], int client, int* len) {<br \/>\n    for (int i &#061; 0; i &lt; *len; i&#043;&#043;) {<br \/>\n        if (arr[i] &#061;&#061; client) {<br \/>\n            for (int j &#061; i; j &lt; *len &#8211; 1; j&#043;&#043;) {<br \/>\n                arr[j] &#061; arr[j &#043; 1]; \/\/ \u524d\u79fb\u8986\u76d6<br \/>\n            }<br \/>\n            (*len)&#8211;;<br \/>\n            break;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>int main(int argc, const char* argv[]) {<br \/>\n    if (argc &lt; 2) {<br \/>\n        printf(&#034;\u7528\u6cd5&#xff1a;%s &lt;\u7aef\u53e3&gt;\\\\n&#034;, argv[0]);<br \/>\n        return 1;<br \/>\n    }<br \/>\n    short port &#061; atoi(argv[1]);<\/p>\n<p>    int client_arr[MAX_CLIENTS] &#061; {0}; \/\/ \u5b58\u50a8\u5ba2\u6237\u7aef\u5957\u63a5\u5b57<br \/>\n    int client_count &#061; 0;              \/\/ \u5f53\u524d\u5ba2\u6237\u7aef\u6570\u91cf<\/p>\n<p>    \/\/ \u521b\u5efa\u670d\u52a1\u5668\u5957\u63a5\u5b57<br \/>\n    int server &#061; socket(AF_INET, SOCK_STREAM, 0);<br \/>\n    if (server &#061;&#061; -1) { perror(&#034;socket&#034;); return 1; }<\/p>\n<p>    \/\/ \u7ed1\u5b9a\u5730\u5740<br \/>\n    struct sockaddr_in addr &#061; {0};<br \/>\n    addr.sin_family &#061; AF_INET;<br \/>\n    addr.sin_port &#061; htons(port);<br \/>\n    addr.sin_addr.s_addr &#061; INADDR_ANY;<br \/>\n    if (bind(server, (struct sockaddr*)&amp;addr, sizeof(addr)) &#061;&#061; -1) {<br \/>\n        perror(&#034;bind&#034;); close(server); return 1;<br \/>\n    }<\/p>\n<p>    \/\/ \u5f00\u59cb\u76d1\u542c<br \/>\n    if (listen(server, 10) &#061;&#061; -1) { perror(&#034;listen&#034;); close(server); return 1; }<br \/>\n    printf(&#034;\u670d\u52a1\u5668\u542f\u52a8&#xff0c;\u76d1\u542c\u7aef\u53e3 %d&#8230;\\\\n&#034;, port);<\/p>\n<p>    \/\/ \u521d\u59cb\u5316select\u76d1\u89c6\u56fe&#xff08;\u4ec5\u76d1\u63a7\u670d\u52a1\u5668\u5957\u63a5\u5b57&#xff09;<br \/>\n    fd_set list;<br \/>\n    FD_ZERO(&amp;list);<br \/>\n    FD_SET(server, &amp;list);<br \/>\n    int max_fd &#061; server &#043; 1; \/\/ select\u9700\u8981\u7684\u6700\u5927fd&#043;1<\/p>\n<p>    while (1) {<br \/>\n        fd_set temp &#061; list; \/\/ \u590d\u5236\u76d1\u89c6\u56fe&#xff08;select\u4f1a\u4fee\u6539temp&#xff09;<br \/>\n        int ret &#061; select(max_fd, &amp;temp, NULL, NULL, NULL);<br \/>\n        if (ret &#061;&#061; -1) { perror(&#034;select&#034;); continue; }<\/p>\n<p>        \/\/ \u5904\u7406\u65b0\u5ba2\u6237\u7aef\u8fde\u63a5<br \/>\n        if (FD_ISSET(server, &amp;temp)) {<br \/>\n            struct sockaddr_in client_addr;<br \/>\n            socklen_t client_len &#061; sizeof(client_addr);<br \/>\n            int client &#061; accept(server, (struct sockaddr*)&amp;client_addr, &amp;client_len);<br \/>\n            if (client &#061;&#061; -1) { perror(&#034;accept&#034;); continue; }<\/p>\n<p>            FD_SET(client, &amp;list);      \/\/ \u52a0\u5165\u76d1\u89c6\u56fe<br \/>\n            insert_client(client_arr, client, &amp;client_count); \/\/ \u52a0\u5165\u6570\u7ec4<br \/>\n            printf(&#034;\u65b0\u5ba2\u6237\u7aef\u8fde\u63a5&#xff1a;%s:%d&#xff08;\u5957\u63a5\u5b57&#xff1a;%d&#xff09;\\\\n&#034;,<br \/>\n                   inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port), client);<br \/>\n            if (client &#043; 1 &gt; max_fd) max_fd &#061; client &#043; 1; \/\/ \u66f4\u65b0\u6700\u5927fd<br \/>\n        }<\/p>\n<p>        \/\/ \u5904\u7406\u5ba2\u6237\u7aef\u6d88\u606f&#xff08;\u8f6c\u53d1\u7ed9\u5176\u4ed6\u5ba2\u6237\u7aef&#xff09;<br \/>\n        for (int i &#061; 0; i &lt; client_count; i&#043;&#043;) {<br \/>\n            int client &#061; client_arr[i];<br \/>\n            if (FD_ISSET(client, &amp;temp)) {<br \/>\n                char buf[BUF_SIZE] &#061; {0};<br \/>\n                int res &#061; read(client, buf, sizeof(buf));<br \/>\n                if (res &#061;&#061; -1) { \/\/ \u8bfb\u51fa\u9519<br \/>\n                    perror(&#034;read&#034;);<br \/>\n                    FD_CLR(client, &amp;list);<br \/>\n                    remove_client(client_arr, client, &amp;client_count);<br \/>\n                    close(client);<br \/>\n                    continue;<br \/>\n                } else if (res &#061;&#061; 0) { \/\/ \u5ba2\u6237\u7aef\u65ad\u5f00<br \/>\n                    printf(&#034;\u5ba2\u6237\u7aef %d \u65ad\u5f00\u8fde\u63a5\\\\n&#034;, client);<br \/>\n                    FD_CLR(client, &amp;list);<br \/>\n                    remove_client(client_arr, client, &amp;client_count);<br \/>\n                    close(client);<br \/>\n                } else { \/\/ \u8f6c\u53d1\u6d88\u606f<br \/>\n                    printf(&#034;\u8f6c\u53d1\u6d88\u606f&#xff1a;%s&#xff08;\u6765\u81ea\u5ba2\u6237\u7aef %d&#xff09;\\\\n&#034;, buf, client);<br \/>\n                    for (int j &#061; 0; j &lt; client_count; j&#043;&#043;) {<br \/>\n                        int target &#061; client_arr[j];<br \/>\n                        if (target !&#061; client) { \/\/ \u6392\u9664\u81ea\u5df1<br \/>\n                            write(target, buf, res);<br \/>\n                        }<br \/>\n                    }<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>    close(server);<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>client1\/2<\/p>\n<p>#include &#034;head.h&#034;<\/p>\n<p>int main() {<br \/>\n    \/\/ \u8fde\u63a5\u670d\u52a1\u5668<br \/>\n    int sockfd &#061; socket(AF_INET, SOCK_STREAM, 0);<br \/>\n    if (sockfd &#061;&#061; -1) { perror(&#034;socket&#034;); return 1; }<\/p>\n<p>    struct sockaddr_in server_addr;<br \/>\n    server_addr.sin_family &#061; AF_INET;<br \/>\n    server_addr.sin_port &#061; htons(PORT);<br \/>\n    server_addr.sin_addr.s_addr &#061; inet_addr(&#034;127.0.0.1&#034;);<\/p>\n<p>    if (connect(sockfd, (struct sockaddr*)&amp;server_addr, sizeof(server_addr)) &#061;&#061; -1) {<br \/>\n        perror(&#034;connect&#034;); close(sockfd); return 1;<br \/>\n    }<br \/>\n    printf(&#034;\u8fde\u63a5\u670d\u52a1\u5668\u6210\u529f&#xff01;\\\\n&#034;);<\/p>\n<p>    \/\/ poll \u76d1\u63a7\u4e24\u4e2afd&#xff1a;\u670d\u52a1\u5668\u5957\u63a5\u5b57 &#043; \u6807\u51c6\u8f93\u5165&#xff08;0&#xff09;<br \/>\n    struct pollfd fds[2];<br \/>\n    fds[0].fd &#061; sockfd;   fds[0].events &#061; POLLIN; \/\/ \u76d1\u63a7\u670d\u52a1\u5668\u6d88\u606f<br \/>\n    fds[1].fd &#061; 0;        fds[1].events &#061; POLLIN; \/\/ \u76d1\u63a7\u952e\u76d8\u8f93\u5165<\/p>\n<p>    while (1) {<br \/>\n        int ret &#061; poll(fds, 2, -1); \/\/ \u963b\u585e\u7b49\u5f85\u4e8b\u4ef6<br \/>\n        if (ret &#061;&#061; -1) { perror(&#034;poll&#034;); continue; }<\/p>\n<p>        \/\/ \u5904\u7406\u670d\u52a1\u5668\u6d88\u606f&#xff08;fds[0]&#xff09;<br \/>\n        if (fds[0].revents &amp; POLLIN) {<br \/>\n            char buf[BUF_SIZE] &#061; {0};<br \/>\n            int res &#061; read(sockfd, buf, sizeof(buf));<br \/>\n            if (res &#061;&#061; -1) { perror(&#034;read&#034;); break; }<br \/>\n            if (res &#061;&#061; 0) { printf(&#034;\u670d\u52a1\u5668\u65ad\u5f00&#xff01;\\\\n&#034;); break; }<br \/>\n            printf(&#034;\u6536\u5230\u6d88\u606f&#xff1a;%s\\\\n&#034;, buf);<br \/>\n        }<\/p>\n<p>        \/\/ \u5904\u7406\u952e\u76d8\u8f93\u5165&#xff08;fds[1]&#xff09;<br \/>\n        if (fds[1].revents &amp; POLLIN) {<br \/>\n            char buf[BUF_SIZE] &#061; {0};<br \/>\n            fgets(buf, sizeof(buf), stdin); \/\/ \u8bfb\u53d6\u4e00\u884c\u8f93\u5165<br \/>\n            buf[strcspn(buf, &#034;\\\\n&#034;)] &#061; &#039;\\\\0&#039;; \/\/ \u53bb\u6389\u6362\u884c\u7b26<br \/>\n            if (strlen(buf) &#061;&#061; 0) continue; \/\/ \u7a7a\u8f93\u5165\u8df3\u8fc7<br \/>\n            write(sockfd, buf, strlen(buf)); \/\/ \u53d1\u6d88\u606f\u7ed9\u670d\u52a1\u5668<br \/>\n        }<br \/>\n    }<\/p>\n<p>    close(sockfd);<br \/>\n    return 0;<br \/>\n}<\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1068\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730145148-688a31841e82f.png\" width=\"2427\" \/><\/h3>\n<h3>\u4e03\u3001\u5173\u952e\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u7279\u6027select\u6a21\u578bpoll\u6a21\u578b<\/tr>\n<tbody>\n<tr>\n<td>\u76d1\u89c6\u5217\u8868\u5bb9\u91cf<\/td>\n<td>\u56fa\u5b9a&#xff08;\u6808\u6570\u7ec4&#xff09;<\/td>\n<td>\u52a8\u6001&#xff08;\u53ef\u5806\u6570\u7ec4&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5217\u8868\u64cd\u4f5c<\/td>\n<td>\u9700\u5907\u4efd\u539f\u5217\u8868&#xff08;\u6fc0\u6d3b\u8986\u76d6\u539f\u5217\u8868&#xff09;<\/td>\n<td>\u65e0\u9700\u5907\u4efd&#xff08;revents\u6807\u8bb0\u6fc0\u6d3b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u6548\u7387<\/td>\n<td>\u53cc\u91cd\u5faa\u73af&#xff0c;\u4f4e<\/td>\n<td>\u5355\u5faa\u73af&#xff0c;\u4e2d\u7b49&#xff08;\u4ecd\u9700\u904d\u5386&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u7075\u6d3b\u6027<\/td>\n<td>\u4f4e<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb879\u6b21\uff0c\u70b9\u8d5e10\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u53c2\u6570\uff1a\t\t\t\uff1a\u6700\u5927\u63cf\u8ff0\u7b26\u503c+1\u3002\t\t\uff1a\u5206\u522b\u76d1\u89c6\u201c\u53ef\u8bfb\/\u53ef\u5199\/\u5f02\u5e38\u201d\u4e8b\u4ef6\u7684\u5217\u8868\u3002\t\t\uff1a\u963b\u585e\u8d85\u65f6\u65f6\u95f4\uff08\u8868\u793a\u6c38\u4e45\u963b\u585e\uff09\u3002\t\t\t\u7279\u70b9\uff1a\u76d1\u89c6\u5217\u8868\u4e0e\u6fc0\u6d3b\u5217\u8868\u5171\u7528\u540c\u4e00\u5757\u5185\u5b58\uff0c\u6fc0\u6d3b\u540e\u4f1a\u8986\u76d6\u539f\u5217\u8868\uff0c\u9700\u624b\u52a8\u5907\u4efd\u30023. \u4f18\u7f3a\u70b9\t\u4f18\u70b9\uff1a\u903b\u8f91\u7b80\u5355\u76f4\u89c2\uff0c\u6613\u4e8e\u5b9e\u73b0\u3002\t\u7f3a\u70b9\uff1a\t\t\t\u76d1\u89c6\u5217\u8868\u5bb9\u91cf\u56fa\u5b9a\uff0c\u65e0\u6cd5\u52a8\u6001\u6269\u5bb9\u3002\t\t\u9700\u989d\u5916\u7ef4\u62a4\u63cf\u8ff0\u7b26\u6570\u7ec4\uff0c\u904d\u5386\u6548\u7387\u4f4e\uff08\u53cc\u91cd\u5faa\u73af\uff09\u3002\t\t\u6bcf\u6b21\u8c03\u7528\u9700\u590d\u5236\u5217\u8868\uff0c\u6d6a\u8d39\u7cfb\u7edf\u8d44\u6e90\u3002\t\t\u4e94\u3001poll\u6a21\u578b\u8be6\u89e31. \u6838\u5fc3\u7ed3\u6784\t\u76d1\u89c6\u5217\u8868\u7c7b\u578b\uff1a\u6570\u7ec4\uff08\u53ef\u52a8\u6001\u6269\u5bb9\uff0c\u6808\/\u5806\u7a7a\u95f4\u5747<\/p>\n","protected":false},"author":2,"featured_media":50305,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[100,78],"topic":[],"class_list":["post-50307","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-100","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09 - \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\/50307.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb879\u6b21\uff0c\u70b9\u8d5e10\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u53c2\u6570\uff1a  \uff1a\u6700\u5927\u63cf\u8ff0\u7b26\u503c+1\u3002 \uff1a\u5206\u522b\u76d1\u89c6\u201c\u53ef\u8bfb\/\u53ef\u5199\/\u5f02\u5e38\u201d\u4e8b\u4ef6\u7684\u5217\u8868\u3002 \uff1a\u963b\u585e\u8d85\u65f6\u65f6\u95f4\uff08\u8868\u793a\u6c38\u4e45\u963b\u585e\uff09\u3002  \u7279\u70b9\uff1a\u76d1\u89c6\u5217\u8868\u4e0e\u6fc0\u6d3b\u5217\u8868\u5171\u7528\u540c\u4e00\u5757\u5185\u5b58\uff0c\u6fc0\u6d3b\u540e\u4f1a\u8986\u76d6\u539f\u5217\u8868\uff0c\u9700\u624b\u52a8\u5907\u4efd\u30023. \u4f18\u7f3a\u70b9 \u4f18\u70b9\uff1a\u903b\u8f91\u7b80\u5355\u76f4\u89c2\uff0c\u6613\u4e8e\u5b9e\u73b0\u3002 \u7f3a\u70b9\uff1a  \u76d1\u89c6\u5217\u8868\u5bb9\u91cf\u56fa\u5b9a\uff0c\u65e0\u6cd5\u52a8\u6001\u6269\u5bb9\u3002 \u9700\u989d\u5916\u7ef4\u62a4\u63cf\u8ff0\u7b26\u6570\u7ec4\uff0c\u904d\u5386\u6548\u7387\u4f4e\uff08\u53cc\u91cd\u5faa\u73af\uff09\u3002 \u6bcf\u6b21\u8c03\u7528\u9700\u590d\u5236\u5217\u8868\uff0c\u6d6a\u8d39\u7cfb\u7edf\u8d44\u6e90\u3002 \u4e94\u3001poll\u6a21\u578b\u8be6\u89e31. \u6838\u5fc3\u7ed3\u6784 \u76d1\u89c6\u5217\u8868\u7c7b\u578b\uff1a\u6570\u7ec4\uff08\u53ef\u52a8\u6001\u6269\u5bb9\uff0c\u6808\/\u5806\u7a7a\u95f4\u5747\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/50307.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T14:51:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730145144-688a31805e7ad.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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50307.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/50307.html\",\"name\":\"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T14:51:50+00:00\",\"dateModified\":\"2025-07-30T14:51:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/50307.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/50307.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50307.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09\"}]},{\"@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":"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09 - \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\/50307.html","og_locale":"zh_CN","og_type":"article","og_title":"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb879\u6b21\uff0c\u70b9\u8d5e10\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u53c2\u6570\uff1a  \uff1a\u6700\u5927\u63cf\u8ff0\u7b26\u503c+1\u3002 \uff1a\u5206\u522b\u76d1\u89c6\u201c\u53ef\u8bfb\/\u53ef\u5199\/\u5f02\u5e38\u201d\u4e8b\u4ef6\u7684\u5217\u8868\u3002 \uff1a\u963b\u585e\u8d85\u65f6\u65f6\u95f4\uff08\u8868\u793a\u6c38\u4e45\u963b\u585e\uff09\u3002  \u7279\u70b9\uff1a\u76d1\u89c6\u5217\u8868\u4e0e\u6fc0\u6d3b\u5217\u8868\u5171\u7528\u540c\u4e00\u5757\u5185\u5b58\uff0c\u6fc0\u6d3b\u540e\u4f1a\u8986\u76d6\u539f\u5217\u8868\uff0c\u9700\u624b\u52a8\u5907\u4efd\u30023. \u4f18\u7f3a\u70b9 \u4f18\u70b9\uff1a\u903b\u8f91\u7b80\u5355\u76f4\u89c2\uff0c\u6613\u4e8e\u5b9e\u73b0\u3002 \u7f3a\u70b9\uff1a  \u76d1\u89c6\u5217\u8868\u5bb9\u91cf\u56fa\u5b9a\uff0c\u65e0\u6cd5\u52a8\u6001\u6269\u5bb9\u3002 \u9700\u989d\u5916\u7ef4\u62a4\u63cf\u8ff0\u7b26\u6570\u7ec4\uff0c\u904d\u5386\u6548\u7387\u4f4e\uff08\u53cc\u91cd\u5faa\u73af\uff09\u3002 \u6bcf\u6b21\u8c03\u7528\u9700\u590d\u5236\u5217\u8868\uff0c\u6d6a\u8d39\u7cfb\u7edf\u8d44\u6e90\u3002 \u4e94\u3001poll\u6a21\u578b\u8be6\u89e31. \u6838\u5fc3\u7ed3\u6784 \u76d1\u89c6\u5217\u8868\u7c7b\u578b\uff1a\u6570\u7ec4\uff08\u53ef\u52a8\u6001\u6269\u5bb9\uff0c\u6808\/\u5806\u7a7a\u95f4\u5747","og_url":"https:\/\/www.wsisp.com\/helps\/50307.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T14:51:50+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730145144-688a31805e7ad.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/50307.html","url":"https:\/\/www.wsisp.com\/helps\/50307.html","name":"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T14:51:50+00:00","dateModified":"2025-07-30T14:51:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/50307.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/50307.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/50307.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u591a\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\uff08select\uff0cpoll\uff09"}]},{"@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\/50307","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=50307"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/50307\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/50305"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=50307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=50307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=50307"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=50307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}