doudeng2184 2013-11-11 05:45
浏览 44
已采纳

是否可以将数据发送到服务器而不下载响应?

I would like to use an android app to send GPS coordinates using a prepaid sim card. My theory is that if i don't download any response and i only send requests, i won't drain the card of money.

To test this: Is there a way to 1. On android; create a certain type of request that does not expect a return? 2. on the server side; (preferably php -lamp stack) not deliver a response?

I feel like it would be something to do with UDP versus TCP.

  • 写回答

2条回答 默认 最新

  • doukui2011 2013-11-11 06:28
    关注

    Creating a socket connection to your server and writing using UDP protocol will do the trick as Steve explain above Here what i did similiar without responce

    InetAddress serverAddr = Inet4Address.getByName("addressIP");
    Socket socket = new Socket(serverAddr, SERVERPORT);
    socket.getOutputStream().write("your data".getBytes());
    

    Where SERVERPORT stands for 8080,4040 anything depends on your server. I Used this piece of code to communicate with Server

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Fluent udf 编写问题
  • ¥15 求合并两个字节流VB6代码
  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题
  • ¥15 海湾GST-DJ-N500
  • ¥15 氧化掩蔽层与注入条件关系
  • ¥15 Django DRF 如何反序列化得到Python对象类型数据
  • ¥15 多数据源与Hystrix的冲突