java - Android to android TCP connection failed -


i'm trying make tcp connection between android phones in same subnet. connection works when use android phone server , android emulator client. when switch emulator other android phone timeout. android phones in same local network(192.168.0.0/24).

client script:

s = new socket();                 s.connect(new inetsocketaddress(ip, tcp_server_port), 10000);                  dataoutputstream dos = new dataoutputstream(s.getoutputstream());                 dos.writeutf("coord");                  s.close();  

server script:

 while(!end){                         //server waiting client here, if needed                         socket s = ss.accept();                          datainputstream dis = new datainputstream(s.getinputstream());                         string msg_received = dis.readutf();                         log.i("gauta",msg_received);                          if(msg_received.equals("coord")) {                              //some work.....                          }                          s.close();                         if (quit){ end = true; }                 }                 ss.close();                   } catch (unknownhostexception e) {                             // todo auto-generated catch block                             e.printstacktrace();                 } catch (ioexception e) {                             // todo auto-generated catch block                             e.printstacktrace();                 } 


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -