{"id":5047,"date":"2024-01-13T19:29:39","date_gmt":"2024-01-13T11:29:39","guid":{"rendered":"https:\/\/www.kenpai.com\/cms\/5047\/"},"modified":"2024-01-13T19:29:39","modified_gmt":"2024-01-13T11:29:39","slug":"tcp-server%e7%9a%84%e5%ae%9e%e7%8e%b0%ef%bc%8c%e5%92%8c%e5%a4%9a%e7%ba%bf%e7%a8%8b%ef%bc%8c%e5%a4%9a%e8%bf%9b%e7%a8%8b%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.kenpai.com\/cms\/5047\/","title":{"rendered":"TCP server\u7684\u5b9e\u73b0\uff0c\u548c\u591a\u7ebf\u7a0b\uff0c\u591a\u8fdb\u7a0b\u670d\u52a1\u5668"},"content":{"rendered":"<\/p>\n<p>socket<\/p>\n<p>\u5728TCP\/IP\u534f\u8bae\u4e2d\uff0c&ldquo;IP\u5730\u5740 TCP\/UDP\u7aef\u53e3\u53f7&rdquo;\u8868\u793a\u552f\u4e00\u7f51\u7edc\u901a\u4fe1\u4e2d\u7684\u4e00\u4e2a\u8fdb\u7a0b\uff0cIP\u5730\u5740 \u7aef\u53e3\u53f7\u79f0\u4e3asocket\u3002 <br \/>\u6ce8\u610f\uff1a <br \/>\u5b57\u8282\u5e8f\u6709\u5927\u7aef\u548c\u5c0f\u7aef\uff0c\u5728\u4e24\u53f0\u4f7f\u7528\u4e0d\u540c\u5b57\u8282\u5e8f\u7684\u4e3b\u673a\u4e0a\u901a\u4fe1\uff0c\u4e3a\u4e86\u8ba9\u4e24\u53f0\u4e3b\u673a\u95f4\u80fd\u6b63\u786e\u7684\u901a\u4fe1\uff0c\u53d1\u9001\u7aef\u603b\u662f\u628a\u5b57\u8282\u5e8f\u8f6c\u6210\u5927\u7aef\u5b57\u8282\u5e8f\u6570\u636e\u540e\u5728\u53d1\u9001\uff0c\u63a5\u6536\u65b9\u77e5\u9053\u63a5\u53d7\u7684\u4e00\u5b9a\u662f\u5927\u7aef\u5b57\u8282\u5e8f\uff0c\u7136\u540e\u6839\u636e\u81ea\u5df1\u7684\u5b57\u8282\u5e8f\u8fdb\u884c\u8f6c\u5316\u5c31\u4e0d\u4f1a\u51fa\u9519\u3002<\/p>\n<p>\u8c03\u7528\u51fd\u6570<\/p>\n<p>int socket(int domain, int type, int protocol)<\/p>\n<p>\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u544a\u8bc9\u7cfb\u7edf\u4f7f\u7528\u54ea\u4e2a\u5e95\u5c42\u534f\u8bae\u65cf\u3002\u5bf9\u4e8eTCP\/IP\u534f\u8bae\u65cf\u8be5\u53c2\u6570\u5e94\u8be5\u8bbe\u7f6e\u4e3aAF_INET\/PF_INET\u7528\u4e8eIPV4\uff0c\u4e24\u4e2a\u503c\u76f8\u540c\u53ef\u4ee5\u6df7\u7528\u3002 \u7b2c\u4e8c\u4e2a\u53c2\u6570 SOCK_STREAM\u8868\u793a\u4f20\u8f93\u5c42\u4f7f\u7528TCP\uff0cSOCK_DGRAM\u8868\u5f0fUDP\u3002 \u7b2c\u4e09\u4e2a\u53c2\u6570\u901a\u5e38\u90fd\u8bbe\u4e3a0\uff0c\u4f7f\u7528\u9ed8\u8ba4\u534f\u8bae\u3002 <br \/>int bind(int sockfd,  struct sockaddr* my_addr, socklen_t len) <br \/>struct sockaddr_in <br \/>{ <br \/>sa_family_t sin_family; \/\/\u5730\u5740\u65cf; AF_INET <br \/>u_int16_t  sin_port; \/\/\u7aef\u53e3\u53f7 <br \/>struct in_addr sin_addr;   \/\/IPV4\u5730\u5740\u7ed3\u6784\u4f53 <br \/>} <br \/>struct in_addr <br \/>{ <br \/>u_int32_t s_addr;   \/\/IPV4\u5730\u5740 <br \/>} <\/p>\n<p>bind\u662f\u5c06my_addr\u6240\u6307\u7684socket\u5206\u914d\u5230\u672a\u547d\u540d\u7684sockfd\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002<\/p>\n<p>int listen(int sockfd, int backlog) <br \/>socket\u88ab\u547d\u540d\u4e4b\u540e\u4e0d\u80fd\u9a6c\u4e0a\u8fde\u63a5\uff0c\u9700\u8981listen\u521b\u5efa\u4e00\u4e2a\u76d1\u542c\u961f\u5217\uff0csockfd\u662f\u6307\u88ab\u76d1\u542c\u7684socket\uff0cbacklog\u662f\u6307\u5904\u4e8e\u8fde\u63a5\u72b6\u6001\u548csocket\u7684\u4e0a\u9650\u3002<\/p>\n<p>int accept(int sockfd, struct sockaddr*addr, socklen_t *len) <br \/>\u4ecelisten\u76d1\u542c\u961f\u5217\u4e2d\u63a5\u53d7\u4e00\u4e2a\u8fde\u63a5\u3002sockfd\u662f\u6267\u884c\u8fc7linten\u63a5\u53d7\u76d1\u542c\u7684socket\u3002<\/p>\n<p>\u5355\u8fdb\u7a0b\u7684server<\/p>\n<p>\/*************************************************************************     &gt; File Name: tcp_server.c     &gt; Author: weierxiao     &gt; Mail: 1091868910@qq.com      &gt; Created Time: Sat 08 Jul 2017 05:15:29 PM CST  ************************************************************************\/  #include&lt;stdio.h&gt; #include&lt;sys\/socket.h&gt; #include&lt;netinet\/in.h&gt; #include&lt;errno.h&gt; #include&lt;sys\/types.h&gt; #include&lt;unistd.h&gt; #include&lt;string.h&gt; #define _PORT_ 9999 #define _BACKLOG_ 10 int main() {     int sock = socket(AF_INET, SOCK_STREAM,0);     if (sock &lt; 0)     {         printf(&quot;socket error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));     }     struct sockaddr_in server_sock;     struct sockaddr_in client_sock;     bzero(&amp;server_sock, sizeof(server_sock));      server_sock.sin_family = AF_INET;     server_sock.sin_addr.s_addr = htonl(INADDR_ANY);     server_sock.sin_port = htons(_PORT_);      if (bind(sock, (struct sockaddr*)&amp;server_sock, sizeof(struct sockaddr_in))&lt; 0)     {         printf(&quot;bind error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         close(sock);         return 1;     }      if (listen(sock, _BACKLOG_)&lt; 0)     {         printf(&quot;listen error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         close(sock);         return 2;     }      printf(&quot;bind and listen success, wait accept!n&quot;);      while (1)     {         socklen_t len = 0;         int client_socket = accept(sock, (struct sockaddr*)&amp;client_sock,&amp;len);         if (client_socket &lt; 0)         {             printf(&quot;accept  error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));             close(sock);             return 3;         }          char buf_ip[INET_ADDRSTRLEN];         memset(buf_ip, 0, sizeof(buf_ip));         inet_ntop(AF_INET, &amp;client_sock.sin_addr, buf_ip, sizeof(buf_ip));          printf(&quot;get connection :ip is  %s, port is %dn &quot;,buf_ip, ntohs(client_sock.sin_port) );          while (1)         {             char buf[1024];             memset(buf, 0, sizeof(buf));              read(client_socket, buf, sizeof(buf));             printf(&quot;client# : %sn&quot;, buf);             printf(&quot;server# :&quot;);             memset(buf, 0, sizeof(buf));             fgets(buf, sizeof(buf), stdin);             buf[strlen(buf) &#8211; 1 ]= \\\\\\&#8217;?\\\\\\&#8217;;             write(client_socket, buf, strlen(buf) 1);             printf(&quot;please wait &#8230;n&quot;);          }     }      close(sock);     return 0;      }    client\u5ba2\u6237\u7aef<\/p>\n<p>#include&lt;stdio.h&gt; #include&lt;sys\/types.h&gt; #include&lt;sys\/socket.h&gt; #include&lt;netinet\/in.h&gt; #include&lt;unistd.h&gt; #include&lt;string.h&gt; #include&lt;errno.h&gt; #include&lt;arpa\/inet.h&gt;  #define SERVER_PORT 9999 #define SERVER_IP &quot;192.168.2.103&quot;  int main(int argc, char *argv[]) {      if (argc != 2)     {         printf(&quot;Usage : client IPn&quot;);         return 1;     }      char *ip = argv[1];     char buf[1024];     memset(buf,0,sizeof(buf));      struct sockaddr_in server_sock;     int sock = socket(AF_INET, SOCK_STREAM, 0);     if (sock &lt; 0)     {         printf(&quot;socket error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));     }      bzero(&amp;server_sock, sizeof(server_sock));     server_sock.sin_family = AF_INET;     inet_pton(AF_INET, SERVER_IP, &amp;server_sock.sin_addr);     server_sock.sin_port = htons(SERVER_PORT);      int ret = connect(sock, (struct sockaddr*)&amp; server_sock, sizeof(server_sock));      if (ret &lt; 0)     {         printf(&quot;connect error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         return 1;     }      printf(&quot;connect sucess!n&quot;);     while(1)     {         printf(&quot;client# :&quot;);         fgets(buf, sizeof(buf), stdin);         buf[strlen(buf)-1] = \\\\\\&#8217;?\\\\\\&#8217;;         write(sock, buf, sizeof(buf));         if (strncasecmp(buf,&quot;quit&quot;, 4) == 0)         {             printf(&quot;quit !n&quot;);             break;         }         printf(&quot;please waitn&quot;);         read(sock, buf, sizeof(buf));         printf(&quot;server #:%sn&quot;, buf);      }     close(sock);     return 0; }<\/p>\n<p>\u6211\u4e3b\u673a\u7684ip\u5730\u5740\u662f192.168.2.103. <br \/>\u8fd0\u884cserver <\/p>\n<p>\u7528\u547d\u4ee4netstat _nltp \u53ef\u4ee5\u67e5\u770b\u5f53\u524d\u4e3b\u673a\u7684tcp\u670d\u52a1 <\/p>\n<p>\u6211\u7ed1\u5b9a\u7684\u662f9999\u7aef\u53e3\uff0cip\u5730\u5740\u8fd8\u6ca1\u786e\u5b9a,\u8fd0\u884c\u5ba2\u6237\u7aef\u8fdb\u884c\u901a\u4fe1 <\/p>\n<p>\u591a\u8fdb\u7a0b\u670d\u52a1\u5668<\/p>\n<p>\u5c06\u901a\u4fe1\u90e8\u5206\u8ba9\u5b50\u8fdb\u7a0b\u53bb\u5904\u7406\uff0c\u5176\u4ed6\u8fc7\u7a0b\u8ba9\u7236\u8fdb\u7a0b\u6765\u5904\u7406\u3002\u4f46\u662f\u95ee\u9898\u6765\u4e86\uff0c\u53ea\u8981\u670d\u52a1\u5668\u4e00\u76f4\u8fd0\u884c\uff0c\u6211\u4eec\u7684\u7236\u8fdb\u7a0b\u5c31\u4e0d\u4f1a\u7ed3\u675f\uff0c\u800c\u5b50\u8fdb\u7a0b\u968f\u65f6\u53ef\u80fd\u7ed3\u675f\uff0c\u8fd9\u6837\u4e00\u6765\u5b50\u8fdb\u7a0b\u5c31\u53d8\u6210\u4e86\u50f5\u5c38\u8fdb\u7a0b\uff0c\u90a3\u4e48\u8fd9\u4e2a\u95ee\u9898\u600e\u4e48\u5904\u7406\u5462\uff1f\u5176\u5b9e\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\u975e\u5e38\u5de7\u5999\uff0c\u6211\u4eec\u8ba9\u5b50\u8fdb\u7a0b\u518dfork\u4e00\u6b21\uff0c\u5f97\u5230\u4e00\u4e2a\u5b59\u5b50\u8fdb\u7a0b\uff0c\u7136\u540e\u7ed3\u675f\u5b50\u8fdb\u7a0b\uff0c\u8fd9\u6837\u5b59\u5b50\u8fdb\u7a0b\u5c31\u6210\u4e86\u5b64\u513f\u8fdb\u7a0b\uff0c\u5b83\u4f1a\u88ab1\u53f7\u8fdb\u7a0b\u56de\u6536\uff0c\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u5e76\u6ca1\u6709\u4ea7\u751f\u50f5\u5c38\u8fdb\u7a0b\uff0c\u8fd9\u4e2a\u95ee\u9898\u5c31\u89e3\u51b3\u4e86\u3002<\/p>\n<p>#include&lt;stdio.h&gt; #include&lt;sys\/socket.h&gt; #include&lt;netinet\/in.h&gt; #include&lt;errno.h&gt; #include&lt;sys\/types.h&gt; #include&lt;unistd.h&gt; #include&lt;string.h&gt; #include&lt;stdlib.h&gt;  #define _PORT_ 9999 #define _BACKLOG_ 10 int main() {     int sock = socket(AF_INET, SOCK_STREAM,0);     if (sock &lt; 0)     {         printf(&quot;socket error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));     }     struct sockaddr_in server_sock;     struct sockaddr_in client_sock;     bzero(&amp;server_sock, sizeof(server_sock));      server_sock.sin_family = AF_INET;     server_sock.sin_addr.s_addr = htonl(INADDR_ANY);     server_sock.sin_port = htons(_PORT_);      if (bind(sock, (struct sockaddr*)&amp;server_sock, sizeof(struct sockaddr_in))&lt; 0)     {         printf(&quot;bind error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         close(sock);         return 1;     }      if (listen(sock, _BACKLOG_)&lt; 0)     {         printf(&quot;listen error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         close(sock);         return 2;     }      printf(&quot;bind and listen success, wait accept!n&quot;);      while (1)     {         socklen_t len = 0;         int client_socket = accept(sock, (struct sockaddr*)&amp;client_sock,&amp;len);         if (client_socket &lt; 0)         {             printf(&quot;accept  error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));             close(sock);             return 3;         }          char buf_ip[INET_ADDRSTRLEN];         memset(buf_ip, 0, sizeof(buf_ip));         inet_ntop(AF_INET, &amp;client_sock.sin_addr, buf_ip, sizeof(buf_ip));          printf(&quot;get connection :ip is  %s, port is %dn &quot;,buf_ip, ntohs(client_sock.sin_port) );          pid_t id = fork();         if (id&lt;0)         {             perror(&quot;fork&quot;);         }         else if(id == 0)         {             close(sock);             pid_t idd = fork();             if (idd &lt; 0)             {                 perror(&quot;second fork&quot;);                 exit(5);             }             else if (idd == 0)             {                     while (1)                     {                         char buf[1024];                         memset(buf, 0, sizeof(buf));                          read(client_socket, buf, sizeof(buf));                         printf(&quot;client# : %sn&quot;, buf);                         printf(&quot;server# :&quot;);                         memset(buf, 0, sizeof(buf));                         fgets(buf, sizeof(buf), stdin);                         buf[strlen(buf) &#8211; 1 ]= \\\\\\&#8217;?\\\\\\&#8217;;                         write(client_socket, buf, strlen(buf) 1);                         printf(&quot;please wait &#8230;n&quot;);                      }             }             else              {                 exit(6);             }         }         else         {             close(client_socket);             waitpid(id, NULL,0);         }      }     close(sock);     return 0;      }     \u591a\u7ebf\u7a0b\u670d\u52a1\u5668<\/p>\n<p>\u591a\u7ebf\u7a0b\u670d\u52a1\u5668\u5c31\u662f\u5c06\u901a\u4fe1\u90e8\u5206\u8ba9\u4e00\u4e2a\u7ebf\u7a0b\u53bb\u5904\u7406\uff0c\u4e3a\u4e86\u907f\u514d\u7ebf\u7a0b\u9000\u51fa\u65f6\u6574\u4e2a\u8fdb\u7a0b\u9000\u51fa\uff0c\u6211\u4eec\u5c06\u7ebf\u7a0b\u5206\u79bb\u51fa\u53bb\u3002<\/p>\n<p>#include&lt;stdio.h&gt; #include&lt;sys\/socket.h&gt; #include&lt;netinet\/in.h&gt; #include&lt;errno.h&gt; #include&lt;sys\/types.h&gt; #include&lt;unistd.h&gt; #include&lt;string.h&gt; #define _PORT_ 9999 #define _BACKLOG_ 10  void request(void* arg) {     int new_fd = (int )arg;     char buf_ip[INET_ADDRSTRLEN];         memset(buf_ip, 0, sizeof(buf_ip));         inet_ntop(AF_INET, &amp;client_sock.sin_addr, buf_ip, sizeof(buf_ip));          printf(&quot;get connection :ip is  %s, port is %dn &quot;,buf_ip, ntohs(client_sock.sin_port) );          while (1)         {             char buf[1024];             memset(buf, 0, sizeof(buf));              read(client_socket, buf, sizeof(buf));             printf(&quot;client# : %sn&quot;, buf);             printf(&quot;server# :&quot;);             memset(buf, 0, sizeof(buf));             fgets(buf, sizeof(buf), stdin);             buf[strlen(buf) &#8211; 1 ]= \\\\\\&#8217;?\\\\\\&#8217;;             write(client_socket, buf, strlen(buf) 1);             printf(&quot;please wait &#8230;n&quot;);                     }     }  } int main() {     int sock = socket(AF_INET, SOCK_STREAM,0);     if (sock &lt; 0)     {         printf(&quot;socket error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));     }     struct sockaddr_in server_sock;     struct sockaddr_in client_sock;     bzero(&amp;server_sock, sizeof(server_sock));      server_sock.sin_family = AF_INET;     server_sock.sin_addr.s_addr = htonl(INADDR_ANY);     server_sock.sin_port = htons(_PORT_);      if (bind(sock, (struct sockaddr*)&amp;server_sock, sizeof(struct sockaddr_in))&lt; 0)     {         printf(&quot;bind error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         close(sock);         return 1;     }      if (listen(sock, _BACKLOG_)&lt; 0)     {         printf(&quot;listen error, errno is %d, errstring is %sn&quot;, errno, strerror(errno));         close(sock);         return 2;     }      printf(&quot;bind and listen success, wait accept!n&quot;);     pthread_t id;     pthread_create(&amp;id, NULL, request, (void*)new_fd );     pthread_detach(id);      close(sock);     return 0;      }    bind\u5931\u8d25\u7684\u539f\u56e0<\/p>\n<p>\u5f53\u4e24\u4e2a socket \u7684 address \u548c port \u76f8\u51b2\u7a81\uff0c\u800c\u4f60\u53c8\u60f3\u91cd\u7528\u5730\u5740\u548c\u7aef\u53e3\uff0c\u5219\u65e7\u7684 socket \u548c\u65b0\u7684 socket \u90fd\u8981\u5df2\u7ecf\u88ab\u8bbe\u7f6e\u4e86 SO_REUSEADDR \u7279\u6027\uff0c\u53ea \u6709\u4e24\u8005\u4e4b\u4e00\u6709\u8fd9\u4e2a\u7279\u6027\u8fd8\u662f\u6709\u95ee\u9898\u7684\u3002  <br \/>SO_REUSEADDR \u53ef\u4ee5\u7528\u5728\u4ee5\u4e0b\u56db\u79cd\u60c5\u51b5\u4e0b\u3002  <br \/>( \u6458\u81ea\u300a Unix \u7f51\u7edc\u7f16\u7a0b\u300b\u5377\u4e00\uff0c\u5373 UNPv1)  <br \/>1 \u3001\u5f53\u6709\u4e00\u4e2a\u6709\u76f8\u540c\u672c\u5730\u5730\u5740\u548c\u7aef\u53e3\u7684 socket1 \u5904\u4e8e TIME_WAIT \u72b6\u6001\u65f6\uff0c\u800c\u4f60\u542f  <br \/>\u52a8\u7684\u7a0b\u5e8f\u7684 socket2 \u8981\u5360\u7528\u8be5\u5730\u5740\u548c\u7aef\u53e3\uff0c\u4f60\u7684\u7a0b\u5e8f\u5c31\u8981\u7528\u5230\u8be5\u9009\u9879\u3002  <br \/>2 \u3001 SO_REUSEADDR \u5141\u8bb8\u540c\u4e00 port \u4e0a\u542f\u52a8\u540c\u4e00\u670d\u52a1\u5668\u7684\u591a\u4e2a\u5b9e\u4f8b ( \u591a\u4e2a\u8fdb\u7a0b ) \u3002\u4f46  <br \/>\u6bcf\u4e2a\u5b9e\u4f8b\u7ed1\u5b9a\u7684 IP \u5730\u5740\u662f\u4e0d\u80fd\u76f8\u540c\u7684\u3002\u5728\u6709\u591a\u5757\u7f51\u5361\u6216\u7528 IP Alias \u6280\u672f\u7684\u673a\u5668\u53ef  <br \/>\u4ee5\u6d4b\u8bd5\u8fd9\u79cd\u60c5\u51b5\u3002  <br \/>3 \u3001 SO_REUSEADDR \u5141\u8bb8\u5355\u4e2a\u8fdb\u7a0b\u7ed1\u5b9a\u76f8\u540c\u7684\u7aef\u53e3\u5230\u591a\u4e2a socket \u4e0a\uff0c\u4f46\u6bcf\u4e2a soc <br \/>ket \u7ed1\u5b9a\u7684 ip \u5730\u5740\u4e0d\u540c\u3002\u8fd9\u548c 2 \u5f88\u76f8\u4f3c\uff0c\u533a\u522b\u8bf7\u770b UNPv1 \u3002  <br \/>4 \u3001 SO_REUSEADDR \u5141\u8bb8\u5b8c\u5168\u76f8\u540c\u7684\u5730\u5740\u548c\u7aef\u53e3\u7684\u91cd\u590d\u7ed1\u5b9a\u3002\u4f46\u8fd9\u53ea\u7528\u4e8e UDP \u7684  <br \/>\u591a\u64ad\uff0c\u4e0d\u7528\u4e8e TCP \u3002<\/p>\n<p>\u66f4\u591a\u5173\u4e8e\u4e91\u670d\u52a1\u5668\uff0c<span class='wp_keywordlink'><a href=\"https:\/\/www.kenpai.com\/domain.html\" title=\"\u57df\u540d\u6ce8\u518c\" target=\"_blank\">\u57df\u540d<\/a><\/span>\u6ce8\u518c\uff0c\u865a\u62df\u4e3b\u673a\u7684\u95ee\u9898\uff0c\u8bf7\u8bbf\u95ee<span class='wp_keywordlink'><a href=\"https:\/\/www.kenpai.com\/\" title=\"\u57a6\u6d3e\u79d1\u6280\u5b98\u7f51\" target=\"_blank\">\u57a6\u6d3e\u79d1\u6280<\/a><\/span>\u5b98\u7f51\uff1a<span class='wp_keywordlink'><a href=\"https:\/\/www.kenpai.com\/\" title=\"\u57a6\u6d3e\u79d1\u6280\u5b98\u7f51\" target=\"_blank\">www.kenpai.com<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>socket\u5728TCP\/IP\u534f\u8bae\u4e2d\uff0c&ldquo;IP\u5730\u5740 TCP\/UDP\u7aef\u53e3\u53f7&rdquo;\u8868\u793a\u552f\u4e00\u7f51\u7edc\u901a\u4fe1\u4e2d\u7684\u4e00\u4e2a\u8fdb\u7a0b\uff0cIP\u5730\u5740 \u7aef\u53e3\u53f7\u79f0\u4e3asocke<\/p>\n","protected":false},"author":2,"featured_media":4348,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3322],"tags":[3916],"class_list":["post-5047","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ktougao","tag-tcp-server"],"_links":{"self":[{"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/posts\/5047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/comments?post=5047"}],"version-history":[{"count":0,"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/posts\/5047\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/media\/4348"}],"wp:attachment":[{"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/media?parent=5047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/categories?post=5047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kenpai.com\/cms\/wp-json\/wp\/v2\/tags?post=5047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}