简体   繁体   English

从Android模拟器捕获网络流量

[英]Capturing network traffic from Android Emulator

In order to debug my Android application I need to take a closer look at the HTTP requests my app produces. 为了调试我的Android应用程序,我需要仔细查看我的应用程序生成的HTTP请求。 For that purpose I have set up Wireshark on my Mac. 为此,我在Mac上设置了Wireshark。

For testing I opened up a browser. 为了测试,我打开了一个浏览器。 All traffic appears fine in Wireshark. Wireshark的所有流量都很好。

Outgoing requests from the Android emulator however do not appear! 但是,来自Android模拟器的传出请求不会出现! But strangely I can see the servers' responses... Why are all outgoing requests invisible? 但奇怪的是我可以看到服务器的响应......为什么所有传出的请求都不可见?

I had your problem as well. 我也有你的问题。 It drove my crazy, but eventually I found out what went wrong by filtering over TCP traffic instead and noticed this strange protocol in Wireshark, Elasticsearch. 它让我疯狂,但最终我通过过滤TCP流量发现了什么问题,并在Wireshark,Elasticsearch中发现了这个奇怪的协议。 So I googled it, and this is what I found: 所以我用谷歌搜索了,这就是我发现的:

9200 - TCP HTTP RESTful interface 9200 - TCP HTTP RESTful接口

9300 - TCP Binary API and inter-cluster communications 9300 - TCP二进制API和集群间通信

And the server I send my requests to were using port 9300. So thats why I did not show any HTTP requests even though my emulator received the response. 我发送请求的服务器正在使用端口9300.这就是为什么即使我的模拟器收到响应,我也没有显示任何HTTP请求。

To sum up : Check if ur server connecting to is using port 9200 or 9300 and change it. 总结一下 :检查连接的服务器是否正在使用端口9200或9300并进行更改。

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

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