I send to nodejs in android
this ---
try {
URL postUrl = new URL("http://192.168.25.36:9001/");
HttpURLConnection con = (HttpURLConnection)postUrl.openConnection();
con.setDoOutput(true);
con.setInstanceFollowRedirects(false);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
OutputStream os = con.getOutputStream();
os.write(jsonArray.toString().getBytes());
os.flush();
con.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
I think it send successful
because when i send, my loger is give to me for success
my loger is trace this send function start and end.
when i wrong port on(search like 1234, 9002), its no send function end successful
but why my node.js server is no action?
my node.js server is
this ---
var http = require('http');
http.createServer(function(req, res){
console.log('server start');
if("POST" == req.method){
console.log('POST');
}
}).listen(SERVER_PORT);
i think when i start on node.js
i recv to "server start" on console
but no one word is recv
how is this possible?
i start node.js but no "server start" msg
but my android send function is normaly end
is this right?
i don't know what is this...