简体   繁体   中英

send and receive strings through http connection in android

I will try to keep my question simple.. using an arduino and an ethernet shield i have succesfully set up an http server. over a telnet interface i can send and receive strings between the server and my computer, and that's all i want. But i want to do it over an android application. i've done my searching and i've found that the simplest connection to an http server is by httpUrlConnection. But i have not managed to get it through. Everywhere i searched there was the same exmple but i had problems with writeStream() and readStream().. just to be clear i do not want to use complicated methods like post, get, put etc etc, i just want to send and receive strings. thanks in advance, Loukas

edit:sorry but after some search i found out i can use http client and not http url connection because i have set up a server at the arduino. my question now is how can i simulate telnet through http, i have found only examples tha use sockets, i want to use httpclient and just send and receive stings like telnet, thanks and i am really sorry i cannot be more clear..

Indeed I can't see the "writeStream" or "readStream" routines in your app. If you made a copy-paste from somewhere, you might want to look at the definitions for those functions...

I googled for an example that looked similar to yours and found this, not sure if it'll help:

http://pastebin.com/gE650RrS

In a nutshell: you need to create those methods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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