{"id":21087,"date":"2025-04-19T04:12:01","date_gmt":"2025-04-18T20:12:01","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/21087.html"},"modified":"2025-04-19T04:12:01","modified_gmt":"2025-04-18T20:12:01","slug":"%e7%ac%ac%e4%b8%89%e5%8d%81%e4%ba%8c%e7%ab%a0-udp-%e5%ae%a2%e6%88%b7%e7%ab%af-%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%80%9a%e4%bf%a1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/21087.html","title":{"rendered":"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1<\/li>\n<li>\u4ecb\u7ecd<\/li>\n<li>\u5efa\u7acb&#096;UDP&#096;\u5957\u63a5\u5b57<\/li>\n<li>\u4e3b\u673a\u5730\u5740<\/li>\n<\/ul>\n<h2>\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1<\/h2>\n<p>\u672c\u9875\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 UDP \u5728\u8fdb\u7a0b\u4e4b\u95f4\u5efa\u7acb\u8fdc\u7a0b\u901a\u4fe1\u3002<\/p>\n<h2>\u4ecb\u7ecd<\/h2>\n<p>\u901a\u8fc7%Net.UDP\u6765\u652f\u6301 UDP\u3002\u6b64\u7c7b\u63d0\u4f9b\u4ee5\u4e0b\u65b9\u6cd5&#xff1a; Send()\u6570\u636e\u5305\u5230\u6307\u5b9a\u7684\u76ee\u7684\u5730\u548c\u7aef\u53e3\u3001 Recv()\u6765\u81ea\u5957\u63a5\u5b57\u7684\u6570\u636e\u5305\u4ee5\u53caReply()\u53d1\u9001\u5668\u6700\u540e\u6536\u5230\u7684\u6570\u636e\u5305\u3002<\/p>\n<p>\u76ee\u6807\u88ab\u6807\u8bc6\u4e3a\u672c\u5730\u4e3b\u673a\u540d\u6216\u8005 IPv4 \u6216 IPv6 \u4e3b\u673a\u5730\u5740\u3002\u8be5\u7aef\u53e3\u53ef\u4ee5\u662f\u6307\u5b9a\u7684\u7aef\u53e3\u53f7\u6216\u52a8\u6001\u7aef\u53e3\u5206\u914d\u3002<\/p>\n<h2>\u5efa\u7acbUDP\u5957\u63a5\u5b57<\/h2>\n<p>\u8981\u4f7f\u7528 UDP&#xff0c;\u5fc5\u987b\u4f7f\u7528%New()\u65b9\u6cd5\u6765\u521b\u5efa UDP \u5957\u63a5\u5b57\u5bf9\u8c61\u3002\u7136\u540e&#xff0c;\u8be5\u5bf9\u8c61\u5b9e\u4f8b\u7528\u4e8e\u53d1\u9001\u3001\u63a5\u6536\u548c\u56de\u590d\u6570\u636e\u5305\u4f20\u8f93\u3002<\/p>\n<p>\u521b\u5efa UDP \u5957\u63a5\u5b57\u5bf9\u8c61\u65f6&#xff0c;\u53ef\u4ee5\u6307\u5b9a\u7aef\u53e3\u53f7\u548c\u4e3b\u673a\u5730\u5740&#xff0c;\u5982\u4e0b\u4f8b\u6240\u793a&#xff1a;<\/p>\n<p>  SET UPDOref&#061;##class(%Net.UDP).%New(3001,&#034;0.0.0.0&#034;)<\/p>\n<p>\u7aef\u53e3\u53f7\u548c\u4e3b\u673a\u5730\u5740\u90fd\u662f\u53ef\u9009\u7684\u3002 %New()\u65b9\u6cd5\u8fd4\u56de UDP \u5957\u63a5\u5b57\u5bf9\u8c61\u5b9e\u4f8b\u7684 OREF&#xff08;\u5bf9\u8c61\u5f15\u7528&#xff09;\u3002<\/p>\n<ul>\n<li>\u670d\u52a1\u5668\u7b49\u5f85\u63a5\u6536\u8bf7\u6c42&#xff0c;\u7136\u540e\u63d0\u4f9b\u6240\u8bf7\u6c42\u7684\u4fe1\u606f\u3002\u56e0\u6b64&#xff0c;\u4f20\u8f93\u7684\u8fd9\u4e00\u65b9\u53ef\u4ee5\u79f0\u4e3a\u63a5\u6536\u65b9\u6216\u63d0\u4f9b\u65b9\u3002\u5f53\u63d0\u4f9b\u8005\u521b\u5efa UDP \u5bf9\u8c61\u65f6&#xff0c;\u5b83\u5fc5\u987b\u5b9a\u4e49\u63a5\u6536\u8bf7\u6c42\u7684\u7aef\u53e3\u53f7\u3002<\/li>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001\u4fe1\u606f\u8bf7\u6c42&#xff0c;\u7136\u540e\u63a5\u6536\u56de\u590d\u3002\u56e0\u6b64&#xff0c;\u4f20\u8f93\u7684\u8fd9\u4e00\u65b9\u53ef\u4ee5\u79f0\u4e3a\u53d1\u9001\u65b9\u6216\u8bf7\u6c42\u65b9\u3002\u5f53\u8bf7\u6c42\u8005\u521b\u5efa UDP \u5bf9\u8c61\u65f6&#xff0c;\u5b83\u53ef\u4ee5\u4f7f\u7528\u52a8\u6001\u7aef\u53e3\u53f7\u3002\u9ed8\u8ba4\u503c\u4e3a0\u3002\u5f53\u5b83\u53d1\u9001\u6570\u636e\u5305\u65f6&#xff0c;\u5fc5\u987b\u6307\u5b9a\u63d0\u4f9b\u8005\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\u3002<\/li>\n<\/ul>\n<h2>\u4e3b\u673a\u5730\u5740<\/h2>\n<p>Send()\u65b9\u6cd5\u6307\u5b9a\u76ee\u6807\u7684\u4e8c\u8fdb\u5236\u5730\u5740\u3002\u8fd9\u662f\u4e3b\u673a\u5730\u5740\u7684\u4e8c\u8fdb\u5236\u7248\u672c\u3002\u5fc5\u987b\u4f7f\u7528GetHostAddr()\u65b9\u6cd5\u521b\u5efa\u6b64\u4e8c\u8fdb\u5236\u4e3b\u673a\u5730\u5740&#xff0c;\u5982\u4e0b\u6240\u793a&#xff1a;<\/p>\n<p>  <span class=\"token class-name\">SET<\/span> client<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>%<span class=\"token class-name\">New<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> addrbin<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">GetHostAddr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;172.16.61.196&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  WRITE <span class=\"token class-name\"><span class=\"token namespace\">client<span class=\"token punctuation\">.<\/span><\/span>Send<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;message text&#034;<\/span><span class=\"token punctuation\">,<\/span>addrbin<span class=\"token punctuation\">,<\/span><span class=\"token number\">3001<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u4ee5\u5411GetHostAddr()\u6307\u5b9a\u4e3b\u673a\u540d\u3001IPv4 \u5730\u5740\u6216 IPv6 \u5730\u5740&#xff0c;\u5982\u4ee5\u4e0b\u793a\u4f8b\u6240\u793a&#xff1a;<\/p>\n<p>  <span class=\"token class-name\">SET<\/span> hostname<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;MYLAPTOP&#034;<\/span><br \/>\n  SET <span class=\"token class-name\">IPv4<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;172.16.61.196&#034;<\/span><br \/>\n  SET <span class=\"token class-name\">IPv6<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;::1&#034;<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> flag<span class=\"token operator\">&#061;<\/span>$<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>CheckAddressExist<\/span><span class=\"token punctuation\">(<\/span>hostname<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token class-name\">IF<\/span> flag<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token class-name\">SET<\/span> addrbin<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">GetHostAddr<\/span><span class=\"token punctuation\">(<\/span>hostname<span class=\"token punctuation\">)<\/span><br \/>\n              WRITE <span class=\"token string\">&#034;host name valid&#034;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n     ELSE <span class=\"token punctuation\">{<\/span> WRITE <span class=\"token string\">&#034;not a hostname: &#034;<\/span><span class=\"token punctuation\">,<\/span>hostname<span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> flag<span class=\"token operator\">&#061;<\/span>$<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>CheckAddressExist<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">IPv4<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token class-name\">IF<\/span> flag<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token class-name\">SET<\/span> addrbin<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">GetHostAddr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">IPv4<\/span><span class=\"token punctuation\">)<\/span><br \/>\n              WRITE <span class=\"token string\">&#034;IPv4 valid&#034;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n     ELSE <span class=\"token punctuation\">{<\/span> WRITE <span class=\"token string\">&#034;not an IPv4 address: &#034;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token class-name\">IPv4<\/span><span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> flag<span class=\"token operator\">&#061;<\/span>$<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>CheckAddressExist<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">IPv6<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token class-name\">IF<\/span> flag<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token class-name\">SET<\/span> addrbin<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">GetHostAddr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">IPv6<\/span><span class=\"token punctuation\">)<\/span><br \/>\n              WRITE <span class=\"token string\">&#034;IPv6 valid&#034;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n     ELSE <span class=\"token punctuation\">{<\/span> WRITE <span class=\"token string\">&#034;not an IPv6 address: &#034;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token class-name\">IPv6<\/span><span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span> <span class=\"token punctuation\">}<\/span><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528AddrToHostName()\u65b9\u6cd5\u5c06\u6b64\u4e8c\u8fdb\u5236\u4e3b\u673a\u5730\u5740\u6269\u5c55\u56de\u4e3b\u673a\u540d&#xff0c;\u5982\u4ee5\u4e0b\u793a\u4f8b\u6240\u793a&#xff1a;<\/p>\n<p>  <span class=\"token class-name\">SET<\/span> addrbin<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">GetHostAddr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;MYLAPTOP&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  WRITE $<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>AddrToHostName<\/span><span class=\"token punctuation\">(<\/span>addrbin<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528LocalHostName()\u6cd5\u6765\u786e\u5b9a\u4e3b\u673a\u540d\u3002\u53ef\u4ee5\u4f7f\u7528HostNameToAddr()\u65b9\u6cd5\u5c06\u4e3b\u673a\u540d\u8f6c\u6362\u4e3a IPv4 \u6216 IPv6 \u5730\u5740&#xff0c;\u5982\u4ee5\u4e0b\u793a\u4f8b\u6240\u793a&#xff1a;<\/p>\n<p>  <span class=\"token class-name\">SET<\/span> localhost<span class=\"token operator\">&#061;<\/span>$<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>LocalHostName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>            <span class=\"token comment\">\/* get host name *\/<\/span><br \/>\n     WRITE <span class=\"token string\">&#034;local host name is &#034;<\/span><span class=\"token punctuation\">,<\/span>localhost<span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> addrbin<span class=\"token operator\">&#061;<\/span>##<span class=\"token keyword\">class<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">%<\/span><span class=\"token class-name\">Net<\/span><span class=\"token punctuation\">.<\/span>UDP<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">GetHostAddr<\/span><span class=\"token punctuation\">(<\/span>localhost<span class=\"token punctuation\">)<\/span>      <span class=\"token comment\">\/* compress to binary address *\/<\/span><br \/>\n     WRITE <span class=\"token string\">&#034;binary form of IP address is &#034;<\/span><span class=\"token punctuation\">,<\/span>addrbin<span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> hostname<span class=\"token operator\">&#061;<\/span>$<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>AddrToHostName<\/span><span class=\"token punctuation\">(<\/span>addrbin<span class=\"token punctuation\">)<\/span>     <span class=\"token comment\">\/* expand binary address to host name *\/<\/span><br \/>\n     WRITE <span class=\"token string\">&#034;binary IP address expands to &#034;<\/span><span class=\"token punctuation\">,<\/span>hostname<span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span><br \/>\n  <span class=\"token class-name\">SET<\/span> ipaddr<span class=\"token operator\">&#061;<\/span>$<span class=\"token class-name\">SYSTEM<span class=\"token punctuation\">.<\/span>INetInfo<span class=\"token punctuation\">.<\/span>HostNameToAddr<\/span><span class=\"token punctuation\">(<\/span>hostname<span class=\"token punctuation\">)<\/span>      <span class=\"token comment\">\/* host name to IP address *\/<\/span><br \/>\n     WRITE <span class=\"token string\">&#034;hostname corresponds to IP address &#034;<\/span><span class=\"token punctuation\">,<\/span>ipaddr<span class=\"token punctuation\">,<\/span><span class=\"token operator\">!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u901a\u8fc7%Net.UDP\u6765\u652f\u6301UDP\u3002\u6b64\u7c7b\u63d0\u4f9b\u4ee5\u4e0b\u65b9\u6cd5\uff1aSend()\u6570\u636e\u5305\u5230\u6307\u5b9a\u7684\u76ee\u7684\u5730\u548c\u7aef\u53e3\u3001Recv()\u6765\u81ea\u5957\u63a5\u5b57\u7684\u6570\u636e\u5305\u4ee5\u53caReply()\u53d1\u9001\u5668\u6700\u540e\u6536\u5230\u7684\u6570\u636e\u5305\u3002\u76ee\u6807\u88ab\u6807\u8bc6\u4e3a\u672c\u5730\u4e3b\u673a\u540d\u6216\u8005IPv4\u6216IPv6\u4e3b\u673a\u5730\u5740\u3002\u8be5\u7aef\u53e3\u53ef\u4ee5\u662f\u6307\u5b9a\u7684\u7aef\u53e3\u53f7\u6216\u52a8\u6001\u7aef\u53e3\u5206\u914d\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1636,193,43,191],"topic":[],"class_list":["post-21087","post","type-post","status-publish","format-standard","hentry","category-server","tag-io","tag-udp","tag-43","tag-191"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1 - \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\/21087.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u901a\u8fc7%Net.UDP\u6765\u652f\u6301UDP\u3002\u6b64\u7c7b\u63d0\u4f9b\u4ee5\u4e0b\u65b9\u6cd5\uff1aSend()\u6570\u636e\u5305\u5230\u6307\u5b9a\u7684\u76ee\u7684\u5730\u548c\u7aef\u53e3\u3001Recv()\u6765\u81ea\u5957\u63a5\u5b57\u7684\u6570\u636e\u5305\u4ee5\u53caReply()\u53d1\u9001\u5668\u6700\u540e\u6536\u5230\u7684\u6570\u636e\u5305\u3002\u76ee\u6807\u88ab\u6807\u8bc6\u4e3a\u672c\u5730\u4e3b\u673a\u540d\u6216\u8005IPv4\u6216IPv6\u4e3b\u673a\u5730\u5740\u3002\u8be5\u7aef\u53e3\u53ef\u4ee5\u662f\u6307\u5b9a\u7684\u7aef\u53e3\u53f7\u6216\u52a8\u6001\u7aef\u53e3\u5206\u914d\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/21087.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-18T20:12:01+00:00\" \/>\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=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/21087.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/21087.html\",\"name\":\"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T20:12:01+00:00\",\"dateModified\":\"2025-04-18T20:12:01+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/21087.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/21087.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/21087.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1\"}]},{\"@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":"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1 - \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\/21087.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf8\u6b21\u3002\u901a\u8fc7%Net.UDP\u6765\u652f\u6301UDP\u3002\u6b64\u7c7b\u63d0\u4f9b\u4ee5\u4e0b\u65b9\u6cd5\uff1aSend()\u6570\u636e\u5305\u5230\u6307\u5b9a\u7684\u76ee\u7684\u5730\u548c\u7aef\u53e3\u3001Recv()\u6765\u81ea\u5957\u63a5\u5b57\u7684\u6570\u636e\u5305\u4ee5\u53caReply()\u53d1\u9001\u5668\u6700\u540e\u6536\u5230\u7684\u6570\u636e\u5305\u3002\u76ee\u6807\u88ab\u6807\u8bc6\u4e3a\u672c\u5730\u4e3b\u673a\u540d\u6216\u8005IPv4\u6216IPv6\u4e3b\u673a\u5730\u5740\u3002\u8be5\u7aef\u53e3\u53ef\u4ee5\u662f\u6307\u5b9a\u7684\u7aef\u53e3\u53f7\u6216\u52a8\u6001\u7aef\u53e3\u5206\u914d\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/21087.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T20:12:01+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/21087.html","url":"https:\/\/www.wsisp.com\/helps\/21087.html","name":"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T20:12:01+00:00","dateModified":"2025-04-18T20:12:01+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/21087.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/21087.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/21087.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7b2c\u4e09\u5341\u4e8c\u7ae0 UDP \u5ba2\u6237\u7aef \u670d\u52a1\u5668\u901a\u4fe1"}]},{"@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\/21087","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=21087"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/21087\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=21087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=21087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=21087"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=21087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}