How to use volley library for network call using Socket(IP address) and port number(eg. 1234)?

你说的曾经没有我的故事 提交于 2019-12-13 21:48:41

问题


I want to send byte [] to make a request and in the response i will get the byte[].So can you please help me.

Right now i am using the Asynctask doInBackground() for the network call and Socket class.

Had gone through some link but could not found the solution. Thanks in advance.


回答1:


Seems Volley is a http library, see this. It's good enough to use AsyncTask for this.

Edit

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.

Quoted from here



来源:https://stackoverflow.com/questions/39344438/how-to-use-volley-library-for-network-call-using-socketip-address-and-port-num

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!