dongxuan1660 2019-02-16 09:02 采纳率: 100%
浏览 75

为什么没有与ec2公共IP建立连接

We have built a vehicle tracking system (VTS) device.I have a PHP script which listens to the client connection.

A connection is established when we connect using the Private IP of an EC2 instance, but when we try to put an external IP or public IP in the php script, then it shows an error.

How can I solve this??

I have launched a Linux virtual machine with Amazon EC2. Then connect to the Linux instance from Windows using putty. There is a php script which listens to incoming connections. When I put the Private IP of EC2 then it gets connected, but when I put the public IP it throws the error "unable to bind ip[99]"

public function __construct($bind_ip,$port)
{
    set_time_limit(0);
    $this->hooks = array();

    $this->config["ip"] = $bind_ip;
    $this->config["port"] = $port;

    $this->master_socket = socket_create(AF_INET, SOCK_STREAM, 0);
    socket_bind($this->master_socket,$this->config["ip"],$this->config["port"]) or die("Issue Binding");
    socket_getsockname($this->master_socket,$bind_ip,$port);
    socket_listen($this->master_socket);
    SocketServer::debug("Listenting for connections on {$bind_ip}:{$port}");
}

We want to get data from the vehicle tracking device. We can set the IP address to that device and put that in the PHP script, but when I run it using the public IP it throws the error "unable to bind ip[99]"

  • 写回答

2条回答 默认 最新

  • duandaiqin6080 2019-02-16 09:08
    关注

    VTS Systems needs static IPs. Are you aure the public one you are putting is static? Public ips are in most cases subnetted.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b