dtvjl64442 2018-04-16 15:07
浏览 71


i am using CURL to get data from server. The way it works is like the following:

  • A device send data to routing application which is found on server.
  • To get the data from the routing application, clients must ask with GET method specifying server address, port and parameter.
  • once a client is connected, the application start sending data on every new packet arrived from the device to connected clients. see below picture

enter image description here

now lets see my code that i run to get the response:

   $curl = curl_init(''); 
   curl_setopt($curl, CURLOPT_PORT, 1818); 
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); 
   $result = curl_exec($curl);
   echo $result;

With this CURL request i can get the response data from routing application. But the routing application will never stop sending data to connected clients, so i will get the result only if i close the routing application, and it will echo every data as one. Now my question is how can i echo each data without closing the connection or the connection closed by the routing application? i.e When data received, display the data without any conditions. You can suggest any other options to forward this data to another server using TCP. Thanks!

  • 写回答

1条回答 默认 最新


      相关推荐 更多相似问题


      • ¥15 关于selenium网页闪退
      • ¥15 怎么用PYTHON解类似于x = y+zx + cy = x+zy + v的方程
      • ¥300 FLASH AS2.0制作一个类似手机上下滑动一样的效果
      • ¥15 为什么使用openFoam 中的icoFoam计算圆柱扰流时出现浮点数例外(核心已转储)
      • ¥15 51单片机外部中断控制数码管
      • ¥15 创建网页里面的图片显示不出来
      • ¥15 语音控制的编写?(语言-c#)
      • ¥15 matlab输入书上的代码运行错误
      • ¥15 matlab怎么做三维曲面
      • ¥50 sph光滑粒子法能否解决阶跃性的问题