简体   繁体   English

我应该使用哪个IP托管聊天服务器?

[英]What IP should I use to host my chat server?

I made chat server in C# using 我使用C#制作了聊天服务器

Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.TCP);
s.Bind(IPAddress.Parse(theIP),thePort);

But then I am getting a 但是后来我得到了

"SocketException was unhandled, The requested address is not valid in its context" “未处理SocketException,请求的地址在其上下文中无效”

How do I look for the correct IP to use? 我如何寻找要使用的正确IP? cmd ipconfig IPv4Address? cmd ipconfig IPv4Address? Because that IP (I believe) is for the internal IP. 因为该IP(我相信)是用于内部IP的。 I want the server IP to be an external IP address that is accessible from outside my network 我希望服务器IP是可以从网络外部访问的外部IP地址

You need to create a static path (sometimes called port forwarding) in your router binding one of your external IP/ports to an internal address and the port needed for your chat server. 您需要在路由器中创建一条静态路径(有时称为端口转发),以将您的外部IP /端口之一绑定到内部地址以及聊天服务器所需的端口。 You will then reference your internal IP address, on your network, in your code. 然后,您将在网络中的代码中引用内部IP地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TCP套接字服务器/客户端连接应使用哪个IP /端口? - What ip/port should i use for TCP Socket Server/Client connection? WCF,用我的IP替换'localhost'还是应该使用NetTcpBinding? - WCF, replacing 'localhost' with my IP or should I use NetTcpBinding? 高性能服务器 - 我应该使用什么? - High Performance Server - what should I Use? C#,WCF,想创建一个聊天应用程序,我应该使用什么绑定? 也许一些例子? - C#, WCF, want to make a chat application, what binding should I use? maybe some examples? Pushlet,长轮询或轮询-在聊天应用程序中应该使用哪一个? - Pushlet, Long polling or polling - Which one should I use in my chat application? 在IIS中托管TCP聊天服务器 - Host TCP Chat Server in IIS 在SQL Server连接字符串中应使用哪种身份验证方法? - What authentication method should I use in SQL server connection string? 我应该为应用程序使用哪些WPF控件? - What WPF controls should I use for my application? 我应该为我的 Azure 门户身份验证使用什么 SSL URL - What SSL URL should I use for my Azure portal authentification 我应该为我的 Windows 服务使用什么网络编程类? - What network programming class should I use for my Windows service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM