node.js - Nodejs server ignores my android app connections but accepts it if it is the same request from mobile chrome browser? -


i have strange problem,every thin working charm until nodejs server decides not accept requests , log anything.i turned off firewall nut yet still exist.i tested send request chrome browser got response.the android app built seems not getting accepted it's server , no not permission problem goes working before whats going on here?!!

even simple nodejs code refusing application:

const http = require('http'); const express=require('express'); const path=require("path"); const socketio=require("socket.io");  var app=express(); var server=http.createserver(app); var io=socketio(server);     io.on("connection",(socket)=>{ console.log("new user connected");    socket.on("hello",(message)=>{         console.log(message);     });   });   server.listen(3500,()=>{    console.log("server up");   }); 

that's simple android app mainactivity :

public class mainactivity extends appcompatactivity {   button send; button open;  public socket msocket; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_main);      button send=(button)findviewbyid(r.id.senddata);     final button open=(button)findviewbyid(r.id.open);     {         try {             msocket = io.socket("http://192.168.0.100:3500");         } catch (urisyntaxexception e) {}          log.d("sadad","wqewq");      }           open.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {               msocket.connect();          }       });       send.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             hashmap<string,string> jsondata=new hashmap<>();             jsondata.put("username","asdasdasdasdas");             jsondata.put("company","asdasdsad");             jsondata.put("job","asdasdsad");                jsonobject object=new jsonobject(jsondata);              msocket.emit("hello",object);         }     });    }  } 

also looked @ logs in android studio having hard time connect no response sending many tcp connections waiting after timeout:

d/libc-netbsd: [getaddrinfo]: hostname=192.168.0.100; servname=(null);                                       cache_mode=(null), netid=0; mark=0 d/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null);      ai_flags=4; ai_family=0 d/libc-netbsd: [getaddrinfo]: hostname=192.168.0.100; servname=(null);    cache_mode=(null), netid=0; mark=0  d/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -