Hello,
i am using GitHub - itead/ITEADLIB_Arduino_WeeESP8266: An easy-to-use Arduino ESP8266 library besed on AT firmware. this library code for my esp8266,
and now for the response code i have to use this :
char *hello = "Hello,";
if(wifi.send(mux_id, (const uint8_t*)hello, strlen(hello))) {
Serial.print("send back ok\r\n");
} else {
Serial.print("send back err\r\n");
}
the problem is if i use explorer on windows i get the response
but when i use android application i dont get any response and is show me blank response.
my android code for this part is :
public String sendRequest(String parameterValue, String ipAddress, String portNumber, String parameterName) {
String serverResponse = "ERROR";
try {
HttpClient httpclient = new DefaultHttpClient(); // create an HTTP client
// define the URL e.g. http://myIpaddress:myport/?pin=13 (to toggle pin 13 for example)
URI website = new URI("http://"+ipAddress+":"+portNumber+"/?"+parameterName+"="+parameterValue);
HttpGet getRequest = new HttpGet(); // create an HTTP GET object
getRequest.setURI(website); // set the URL of the GET request
HttpResponse response = httpclient.execute(getRequest); // execute the request
// get the ip address server's reply
InputStream content = null;
content = response.getEntity().getContent();
BufferedReader in = new BufferedReader(new InputStreamReader(
content
));
serverResponse = in.readLine();
// Close the connection
content.close();
} catch (ClientProtocolException e) {
// HTTP error
serverResponse = e.getMessage();
e.printStackTrace();
} catch (IOException e) {
// IO error
serverResponse = e.getMessage();
e.printStackTrace();
} catch (URISyntaxException e) {
// URL syntax error
serverResponse = e.getMessage();
e.printStackTrace();
}
// return the server's reply/response text
return serverResponse;
}
i think the problem is i have char as a replay but in my android code there is string and i have no idea how to fix it.
anyone can help me please?
thanks