If you need to refer to your pc host's localhost when your emu and pc in the same computer use 10.0.2.2
127.0.0.1 refers to emulator localhost. Powered by Telkomsel BlackBerry® -----Original Message----- From: Hal <dsheppar...@gmail.com> Sender: android-developers@googlegroups.com Date: Sat, 4 Dec 2010 16:28:07 To: Android Developers<android-developers@googlegroups.com> Reply-To: android-developers@googlegroups.com Subject: [android-developers] Re: connect my phone(Galaxy 2.1) to PC using socket communication, which IP and port number should i use? you need to determine the ip of your computer and the appropriate port for the server. Client/Server should match. On Dec 3, 12:43 am, Tantu <arungopa...@gmail.com> wrote: > i want to connect my phone to PC using socket communication and my > phone acts as a client in this communication. my code is working in > emulator but not in phone.It shows an error like this: > "java.net.SocketException: network unreachable in android" while > running. > > //code part// > socket = new Socket("127.0.0.1", 5228); -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en