android - 如何使用Volley库通过套接字(IP地址)和端口号(例如1234)进行网络调用?

标签 android sockets android-asynctask android-volley

我想发送byte []进行请求,并且在响应中我将获得byte []。因此,请您帮我一下。

现在,我正在使用Asynctask doInBackground()进行网络调用和Socket类。

已经通过一些链接,但找不到解决方案。
提前致谢。

最佳答案

似乎Volley是一个http库,请参阅this。为此使用AsyncTask就足够了。

编辑

Kryonet is another very good Java network library for sending TCP and UDP packets over network efficiently which runs on Android as well. Though whenever I used Kryonet, I wrote both the server side code and client side code using this library. Kryonet keeps the connection alive though, so if you don't have any issues changing your server side code from Python to Java (Kryonet has samples which you can use), then it will serve your purpose well. Using this library, you don't even need to hardcode any IP address. You can discover the local server in real time with just one line of code.



引用自here

关于android - 如何使用Volley库通过套接字(IP地址)和端口号(例如1234)进行网络调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39344438/

相关文章:

java - 使用 android studio 在应用程序中流式传输实时摄像头信息

Android - 如何在长按时停止 Linkify?

c# - Xamarin Android C# - 使用 Microsoft.SqlServer.Management

java - 如何在 Java 中通过套接字发送文件列表

java - 运行 runnable 后应用卡住

c - 如何在 C 中将客户端的 IP 存储在数组中(套接字编程)

c++ - 在 C++ 中将字节字符串转换为普通字符串

android-asynctask - 如果从内部调用 API,onPrepareOptionsMenu 的行为会很奇怪

android 异步任务 NetworkOnMainThreadException

java - Java的SwingWorker和Android的AsyncTask的区别