简体   繁体   English

如何使Java ServerSocket在线?

[英]How to put Java ServerSocket online?

I have a Java program that uses ServerSocket to listen for connections on my local port. 我有一个使用ServerSocket侦听本地端口上的连接的Java程序。 I want to put this online so other people can also run the client and connect. 我想将其放在网上,以便其他人也可以运行客户端并进行连接。 I just want the host to literally run my .java program in an infinite loop. 我只希望主机在无限循环中运行我的.java程序。 All the cloud hosting sites talk about Apache, Maven, and databases but that all goes over my head. 所有的云托管站点都谈论Apache,Maven和数据库,但这一切都困扰着我。 How can I get them to run my .java file in an infinite loop so people worldwide can connect to the server socket? 如何让他们无限循环地运行.java文件,以便全世界的人们都可以连接到服务器套接字?

You can have your own server at home, you only need to contract to your Internet Service Provider and they will give you a publc IP and your server will be public. 您可以在家中拥有自己的服务器,只需与Internet服务提供商签约,他们就会为您提供公共IP,并且您的服务器将是公共的。

Another option is to contract a cloud server like Amazon EC2, they have an option and give you a basic server free for a year. 另一个选择是与Amazon EC2之类的云服务器签约,他们可以选择为您提供一年的免费基本服务器。

https://aws.amazon.com/es/ec2/ https://aws.amazon.com/es/ec2/

Or you can contract a VPS virtual private server, it's a dedicated server online for you, it's like EC2 but without virtual machines 或者,您也可以签约VPS虚拟专用服务器,这是在线专用服务器,就像EC2,但没有虚拟机

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM