1

I have connected Android application to PC by Socket connection. The code I used very simple like:

InetAddress hostIP = InetAddress.getByAddress(SERVER_IP);
Sender_Socket = new Socket(hostIP, SERVERPORT);

My SERVER_IP is: "10.224.41.104" hostIP is 10.-32.41.104 and IOException occur when create new Socket with hostIP

How should I fix this problem? Thanks for all help ^^

Neo
  • 1,469
  • 3
  • 23
  • 40
  • So, what's the problem? – KovBal Aug 06 '15 at 09:54
  • @KovBal: the problem is IOException occur – Neo Aug 06 '15 at 09:58
  • Did you checked what happens with Wireshark or any other network diagnostics tool? It could be a firewall, etc. – KovBal Aug 06 '15 at 10:00
  • What is the message associtated with the IOException? – Dimitri Aug 06 '15 at 10:00
  • @KovBal: I had developed by Xamarin (C#) and connection is OK. but when I use native with Android, this problem occur. so I don't think firewall... prevent the connection – Neo Aug 06 '15 at 10:06
  • @Dimitri: 08-06 17:05:20.729: E/APP(17446): java.net.SocketException: socket failed: EACCES (Permission denied) – Neo Aug 06 '15 at 10:06
  • 1
    There you go: http://stackoverflow.com/a/2378619 – KovBal Aug 06 '15 at 10:08
  • @KovBal: Thank you very much! This fix my problem ^^ – Neo Aug 06 '15 at 10:19
  • `SERVER_IP ` and `hostIP` are the SAME just represented in different dataType (InetAddress and a String) so there is no sense there IP value is NOT the same... you are mixing something or is it just a typo ? – Yazan Aug 06 '15 at 11:29

0 Answers0