我用bitnami创建了Google虚拟机实例,以启动PHP、MySQL和apache。
我已经允许防火墙在8086端口谷歌云平台。
我创建了两个文件:
server.php,这是
- stored in google cloud
- create server socket on port 8086
- run using SSH with PHP-CLI
- socket is binding and listening to port 8086 successfully
client.php,这是
- stored in my local PC
-
我制作了一个非常简单的命令chat基础应用程序。
虽然该项目包括一个作为服务器的功能,另一个是客户机,它发送套接字并从服务器接收套接字。
但是服务器不是Servlet或任何其他类型的,它只是一个简单的普通java类,通过ServerSocket作为服务器.
如果它可以在线托管(最好是云),我如何知道客户端使用的新主机名?港口会换到吗?
服务器类
public class ServerDoor {
public static void main(String args[]) throws IOException {
final int portNumber = 81;