{"id":27119,"date":"2025-04-19T18:21:02","date_gmt":"2025-04-19T10:21:02","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/27119.html"},"modified":"2025-04-19T18:21:02","modified_gmt":"2025-04-19T10:21:02","slug":"unity%e7%bd%91%e7%bb%9c%e5%bc%80%e5%8f%91%e8%ae%b0%e5%bd%95%ef%bc%88%e4%b8%80%ef%bc%89%ef%bc%9a%e5%ae%9e%e7%8e%b0%e6%9c%80%e7%ae%80%e5%8d%95%e7%9a%84unity%e5%ae%a2%e6%88%b7%e7%ab%af%e5%92%8c%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/27119.html","title":{"rendered":"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u901a\u4fe1"},"content":{"rendered":"<h2>\u670d\u52a1\u7aef<\/h2>\n<p>\u6848\u4f8b\u901a\u8fc7Socket\u7f51\u7edc\u5957\u63a5\u5b57\u5b9e\u73b0Tcp\u7f51\u7edc\u901a\u8baf<\/p>\n<p>\u6253\u5f00VS&#xff0c;\u65b0\u5efa\u4e00\u4e2a\u9879\u76ee<\/p>\n<p>C#\u670d\u52a1\u7aef\u6574\u4f53\u6d41\u7a0b\u4f9d\u65e7\u9075\u4ecesocket\u5f00\u53d1\u7684\u57fa\u672c\u6b65\u9aa4&#xff0c;\u548c\u5176\u5b83\u8bed\u8a00\u4e0b\u7684socket\u5f00\u53d1\u4e00\u6837&#xff0c;\u4f8b\u5982c&#043;&#043;<\/p>\n<li>\u65b0\u5efasocket\u5bf9\u8c61<\/li>\n<li>\u5411socket\u5bf9\u8c61\u7ed1\u5b9a\u534f\u8bae\u7c07\u3001\u4f20\u8f93\u683c\u5f0f\u3001\u534f\u8bae\u7c7b\u578b<\/li>\n<li>\u65b0\u5efa\u4e00\u4e2a\u80fd\u5b58\u50a8ip\u5730\u5740\u4ee5\u53ca\u7aef\u53e3\u53f7\u7684\u5bf9\u8c61<\/li>\n<li>socket\u5bf9\u8c61\u7ed1\u5b9aip\u5730\u5740\u4ee5\u53ca\u7aef\u53e3\u53f7<\/li>\n<li>socket\u5bf9\u8c61\u5f00\u542f\u76d1\u542c<\/li>\n<li>socket\u5bf9\u8c61\u6301\u7eed\u8fdb\u884c\u76d1\u542c\u8fde\u63a5\u8bf7\u6c42&#xff0c;\u5982\u6709\u65b0\u8fde\u63a5&#xff0c;\u8fd4\u56de\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u4e4b\u95f4\u901a\u4fe1\u7684socket\u5bf9\u8c61&#xff08;\u6b64\u8fc7\u7a0b\u963b\u585e&#xff0c;\u76f4\u5230\u6709\u65b0\u8fde\u63a5&#xff09;<\/li>\n<li>\u5efa\u7acb\u8fde\u63a5&#xff0c;\u6b64\u65f6\u53ef\u4ee5\u8fdb\u884c\u4fe1\u606f\u7684\u6536\u53d1<\/li>\n<li>\u5207\u65ad\u901a\u8baf\u5173\u95edsocket<\/li>\n<p>\u8865\u5145\u4e00\u4e0b\u524d\u7f6e\u77e5\u8bc6&#xff0c;\u5728Tcp\u4f20\u8f93\u4e0b&#xff0c;\u4f1a\u7ecf\u5386\u4e09\u62a5\u6587\u63e1\u624b\u5efa\u7acb\u8fde\u63a5&#xff0c;\u56db\u62a5\u6587\u6325\u624b\u91ca\u653e\u8fde\u63a5\u3002\u4e09\u62a5\u6587\u63e1\u624b\u9632\u6b62\u4ee5\u5931\u6548\u7684\u8fde\u63a5\u8bf7\u6c42\u91cd\u65b0\u4f20\u5230\u670d\u52a1\u7aef&#xff0c;\u56db\u62a5\u6587\u6325\u624b\u4e4b\u540e\u8981\u7b49\u5f852MSL&#xff0c;\u786e\u4fdd\u6b64\u8fc7\u7a0b\u4e2d\u7684\u62a5\u6587\u5168\u90e8\u5931\u6548&#xff0c;\u5e76\u9632\u6b62\u91ca\u653e\u8bf7\u6c42\u786e\u8ba4\u62a5\u6587\u4e22\u5931&#xff0c;\u53ca\u65f6\u91cd\u4f20\u3002Tcp\u4f20\u8f93\u5177\u6709\u65e0\u5dee\u9519&#xff0c;\u4e0d\u4e22\u5931&#xff0c;\u4e0d\u91cd\u590d&#xff0c;\u4e0d\u4e71\u5e8f\u7684\u7279\u70b9&#xff0c;\u9002\u5408\u957f\u8fde\u63a5\u7684\u6e38\u620f<\/p>\n<p>\u4f20\u8f93\u4fe1\u606f\u4f7f\u7528UTF-8\u7f16\u7801<\/p>\n<p>\u670d\u52a1\u7aef\u4ee3\u7801&#xff1a;<\/p>\n<p>using System;<br \/>\nusing System.Net;<br \/>\nusing System.Net.Sockets;<br \/>\nusing System.Text;<\/p>\n<p>namespace C_NetWorke<br \/>\n{<br \/>\n    internal class Program<br \/>\n    {<br \/>\n        static void Main(string[] args)<br \/>\n        {<br \/>\n            Socket tcpSocket &#061; new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);<\/p>\n<p>            try<br \/>\n            {<br \/>\n                IPEndPoint ip &#061; new IPEndPoint(IPAddress.Parse(&#034;127.0.0.1&#034;), 8080);<br \/>\n                tcpSocket.Bind(ip);<br \/>\n            }<br \/>\n            catch (Exception)<br \/>\n            {<br \/>\n                return;<br \/>\n            }<\/p>\n<p>            tcpSocket.Listen(1024);<\/p>\n<p>            Socket clientSocket &#061; tcpSocket.Accept();<\/p>\n<p>            clientSocket.Send(Encoding.UTF8.GetBytes(&#034;\u4f60\u597d&#xff0c;\u6211\u662f\u670d\u52a1\u7aef&#034;));<\/p>\n<p>            byte[] buffer &#061; new byte[1024];<br \/>\n            int num &#061; clientSocket.Receive(buffer);<\/p>\n<p>            if (clientSocket.RemoteEndPoint !&#061; null)<br \/>\n            {<br \/>\n                Console.WriteLine($&#034;\u6536\u5230\u6765\u6b21{clientSocket.RemoteEndPoint.ToString()}&#xff0c;\u53d1\u6765\u7684\u6d88\u606f&#xff1a;{Encoding.UTF8.GetString(buffer, 0, num)}&#034;);<br \/>\n            }<\/p>\n<p>            clientSocket.Shutdown(SocketShutdown.Both);<br \/>\n            clientSocket.Close();<\/p>\n<p>            Console.ReadLine();<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<h2>\u5ba2\u6237\u7aef<\/h2>\n<li>\u65b0\u5efasocket\u5bf9\u8c61<\/li>\n<li>\u5411socket\u5bf9\u8c61\u7ed1\u5b9a&#xff0c;\u548c\u670d\u52a1\u7aef\u4e00\u6837<\/li>\n<li>\u542f\u52a8\u8fde\u63a5&#xff0c;\u7533\u8bf7\u5411\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5<\/li>\n<li>\u8fde\u63a5\u6210\u529f&#xff0c;\u53ef\u4ee5\u6536\u53d1\u6570\u636e<\/li>\n<li>\u5207\u65ad\u901a\u8baf&#xff0c;\u5173\u95edsocket<\/li>\n<p>\u5728unity\u4e2d\u65b0\u5efa\u4e00\u4e2a\u811a\u672c<\/p>\n<p>using System.Collections;<br \/>\nusing System.Collections.Generic;<br \/>\nusing UnityEngine;<\/p>\n<p>using System;<br \/>\nusing System.Net;<br \/>\nusing System.Net.Sockets;<br \/>\nusing System.Text;<\/p>\n<p>public class Class5 : MonoBehaviour<br \/>\n{<br \/>\nprivate void Start()<br \/>\n{<br \/>\nSocket socket &#061; new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);<br \/>\nIPEndPoint ipPoint &#061; new IPEndPoint(IPAddress.Parse(&#034;127.0.0.1&#034;), 8080);<br \/>\ntry<br \/>\n{<br \/>\nsocket.Connect(ipPoint);<br \/>\n}<br \/>\ncatch (SocketException e)<br \/>\n{<br \/>\nif (e.ErrorCode &#061;&#061; 10061)<br \/>\nprint(&#034;\u670d\u52a1\u5668\u62d2\u7edd\u94fe\u63a5&#034;);<br \/>\nelse<br \/>\nprint(&#034;\u94fe\u63a5\u51fa\u9519&#034; &#043; e.ErrorCode);<br \/>\nreturn;<br \/>\n}<br \/>\nsocket.Send(Encoding.UTF8.GetBytes(&#034;\u4f60\u597d&#xff0c;\u6211\u662f\u5ba2\u6237\u7aef&#034;));<br \/>\nbyte[] buffer &#061; new byte[1024];<br \/>\nint num &#061; socket.Receive(buffer);<br \/>\nif (socket.RemoteEndPoint !&#061; null)<br \/>\n{<br \/>\nprint($&#034;\u6536\u5230\u6765\u6b21{socket.RemoteEndPoint.ToString()}&#xff0c;\u53d1\u6765\u7684\u6d88\u606f&#xff1a;{Encoding.UTF8.GetString(buffer, 0, num)}&#034;);<br \/>\n}<br \/>\nsocket.Shutdown(SocketShutdown.Both);<br \/>\nsocket.Close();<br \/>\n    }<\/p>\n<p>}<\/p>\n<p>\u542f\u52a8\u670d\u52a1\u5668\u540e&#xff0c;\u518d\u8fd0\u884cunity&#xff0c;\u53d1\u73b0\u8fde\u63a5\u6210\u529f&#xff0c;\u6b64\u65f6\u5b8c\u6210\u4e86\u7f51\u7edc\u901a\u8baf\u7684\u521d\u6b65\u642d\u5efa<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb961\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u6848\u4f8b\u901a\u8fc7Socket\u7f51\u7edc\u5957\u63a5\u5b57\u5b9e\u73b0Tcp\u7f51\u7edc\u901a\u8baf\u6253\u5f00VS\uff0c\u65b0\u5efa\u4e00\u4e2a\u9879\u76eeC#\u670d\u52a1\u7aef\u6574\u4f53\u6d41\u7a0b\u4f9d\u65e7\u9075\u4ecesocket\u5f00\u53d1\u7684\u57fa\u672c\u6b65\u9aa4\uff0c\u548c\u5176\u5b83\u8bed\u8a00\u4e0b\u7684socket\u5f00\u53d1\u4e00\u6837\uff0c\u4f8b\u5982c++\u8865\u5145\u4e00\u4e0b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5728Tcp\u4f20\u8f93\u4e0b\uff0c\u4f1a\u7ecf\u5386\u4e09\u62a5\u6587\u63e1\u624b\u5efa\u7acb\u8fde\u63a5\uff0c\u56db\u62a5\u6587\u6325\u624b\u91ca\u653e\u8fde\u63a5\u3002\u4e09\u62a5\u6587\u63e1\u624b\u9632\u6b62\u4ee5\u5931\u6548\u7684\u8fde\u63a5\u8bf7\u6c42\u91cd\u65b0\u4f20\u5230\u670d\u52a1\u7aef\uff0c\u56db\u62a5\u6587\u6325\u624b\u4e4b\u540e\u8981\u7b49\u5f852MSL\uff0c\u786e\u4fdd\u6b64\u8fc7\u7a0b\u4e2d\u7684\u62a5\u6587\u5168\u90e8\u5931\u6548\uff0c\u5e76\u9632\u6b62\u91ca\u653e\u8bf7\u6c42\u786e\u5b9e\u62a5\u6587\u4e22\u5931\uff0c\u53ca\u65f6\u91cd\u4f20\u3002Tcp\u4f20\u8f93\u5177\u6709\u65e0\u5dee\u9519\uff0c\u4e0d\u4e22\u5931\uff0c\u4e0d\u91cd\u590d\uff0c\u4e0d\u4e71\u5e8f\u7684\u7279\u70b9\uff0c\u9002\u5408\u957f\u8fde\u63a5\u7684\u6e38\u620f\u3002_unity\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4ea4\u4e92<\/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":[55,183,43,78],"topic":[],"class_list":["post-27119","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-unity","tag-43","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\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\/27119.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb961\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u6848\u4f8b\u901a\u8fc7Socket\u7f51\u7edc\u5957\u63a5\u5b57\u5b9e\u73b0Tcp\u7f51\u7edc\u901a\u8baf\u6253\u5f00VS\uff0c\u65b0\u5efa\u4e00\u4e2a\u9879\u76eeC#\u670d\u52a1\u7aef\u6574\u4f53\u6d41\u7a0b\u4f9d\u65e7\u9075\u4ecesocket\u5f00\u53d1\u7684\u57fa\u672c\u6b65\u9aa4\uff0c\u548c\u5176\u5b83\u8bed\u8a00\u4e0b\u7684socket\u5f00\u53d1\u4e00\u6837\uff0c\u4f8b\u5982c++\u8865\u5145\u4e00\u4e0b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5728Tcp\u4f20\u8f93\u4e0b\uff0c\u4f1a\u7ecf\u5386\u4e09\u62a5\u6587\u63e1\u624b\u5efa\u7acb\u8fde\u63a5\uff0c\u56db\u62a5\u6587\u6325\u624b\u91ca\u653e\u8fde\u63a5\u3002\u4e09\u62a5\u6587\u63e1\u624b\u9632\u6b62\u4ee5\u5931\u6548\u7684\u8fde\u63a5\u8bf7\u6c42\u91cd\u65b0\u4f20\u5230\u670d\u52a1\u7aef\uff0c\u56db\u62a5\u6587\u6325\u624b\u4e4b\u540e\u8981\u7b49\u5f852MSL\uff0c\u786e\u4fdd\u6b64\u8fc7\u7a0b\u4e2d\u7684\u62a5\u6587\u5168\u90e8\u5931\u6548\uff0c\u5e76\u9632\u6b62\u91ca\u653e\u8bf7\u6c42\u786e\u5b9e\u62a5\u6587\u4e22\u5931\uff0c\u53ca\u65f6\u91cd\u4f20\u3002Tcp\u4f20\u8f93\u5177\u6709\u65e0\u5dee\u9519\uff0c\u4e0d\u4e22\u5931\uff0c\u4e0d\u91cd\u590d\uff0c\u4e0d\u4e71\u5e8f\u7684\u7279\u70b9\uff0c\u9002\u5408\u957f\u8fde\u63a5\u7684\u6e38\u620f\u3002_unity\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4ea4\u4e92\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/27119.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-19T10:21:02+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\/27119.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/27119.html\",\"name\":\"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T10:21:02+00:00\",\"dateModified\":\"2025-04-19T10:21:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/27119.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/27119.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/27119.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\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":"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\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\/27119.html","og_locale":"zh_CN","og_type":"article","og_title":"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb961\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u6848\u4f8b\u901a\u8fc7Socket\u7f51\u7edc\u5957\u63a5\u5b57\u5b9e\u73b0Tcp\u7f51\u7edc\u901a\u8baf\u6253\u5f00VS\uff0c\u65b0\u5efa\u4e00\u4e2a\u9879\u76eeC#\u670d\u52a1\u7aef\u6574\u4f53\u6d41\u7a0b\u4f9d\u65e7\u9075\u4ecesocket\u5f00\u53d1\u7684\u57fa\u672c\u6b65\u9aa4\uff0c\u548c\u5176\u5b83\u8bed\u8a00\u4e0b\u7684socket\u5f00\u53d1\u4e00\u6837\uff0c\u4f8b\u5982c++\u8865\u5145\u4e00\u4e0b\u524d\u7f6e\u77e5\u8bc6\uff0c\u5728Tcp\u4f20\u8f93\u4e0b\uff0c\u4f1a\u7ecf\u5386\u4e09\u62a5\u6587\u63e1\u624b\u5efa\u7acb\u8fde\u63a5\uff0c\u56db\u62a5\u6587\u6325\u624b\u91ca\u653e\u8fde\u63a5\u3002\u4e09\u62a5\u6587\u63e1\u624b\u9632\u6b62\u4ee5\u5931\u6548\u7684\u8fde\u63a5\u8bf7\u6c42\u91cd\u65b0\u4f20\u5230\u670d\u52a1\u7aef\uff0c\u56db\u62a5\u6587\u6325\u624b\u4e4b\u540e\u8981\u7b49\u5f852MSL\uff0c\u786e\u4fdd\u6b64\u8fc7\u7a0b\u4e2d\u7684\u62a5\u6587\u5168\u90e8\u5931\u6548\uff0c\u5e76\u9632\u6b62\u91ca\u653e\u8bf7\u6c42\u786e\u5b9e\u62a5\u6587\u4e22\u5931\uff0c\u53ca\u65f6\u91cd\u4f20\u3002Tcp\u4f20\u8f93\u5177\u6709\u65e0\u5dee\u9519\uff0c\u4e0d\u4e22\u5931\uff0c\u4e0d\u91cd\u590d\uff0c\u4e0d\u4e71\u5e8f\u7684\u7279\u70b9\uff0c\u9002\u5408\u957f\u8fde\u63a5\u7684\u6e38\u620f\u3002_unity\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4ea4\u4e92","og_url":"https:\/\/www.wsisp.com\/helps\/27119.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T10:21:02+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\/27119.html","url":"https:\/\/www.wsisp.com\/helps\/27119.html","name":"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u901a\u4fe1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T10:21:02+00:00","dateModified":"2025-04-19T10:21:02+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/27119.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/27119.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/27119.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Unity\u7f51\u7edc\u5f00\u53d1\u8bb0\u5f55\uff08\u4e00\uff09\uff1a\u5b9e\u73b0\u6700\u7b80\u5355\u7684unity\u5ba2\u6237\u7aef\u548c\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\/27119","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=27119"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/27119\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=27119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=27119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=27119"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=27119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}