thanks jason, i am able to connect but when i try to read data from inputStream at server side i got exception java.net.SocketException: Connection reset
client: Socket socket = new Socket(SERVER_IP , 8626 ); os = new DataOutputStream(socket.getOutputStream()); os.writeBytes("HELO\n"); server: socket = new ServerSocket(port); incoming = socket.accept(); readerIn = new BufferedReader(new InputStreamReader(incoming.getInputStream())); String str = readerIn.readLine(); // Exception at this line On Thu, Jul 16, 2009 at 8:15 PM, Jason Proctor < jason.android.li...@gmail.com> wrote: > (did my previous post not make it? i don't see my posts so i can't tell. > and list latency seems to be a random number again.) > > 10.0.2.2 is an emulator only alias. to connect to your computer from a real > phone, you have to determine its DNS resolvable name or IP address and > connect to that. > > there isn't a way round this. > > > > thanks for the reply Yusuf, >> >> i am able to connect socket through this ip 10.0.2.2 in emulator as Grob >> suggested >> in a different thread but when i check it on real device it gives me "no >> route to host" exception. >> >> my android device is attached to the same pc my server program is running >> on. >> >> i dont know which ip shall i use in my real device to connect to the >> server pc >> >> >> >> >> On Thu, Jul 16, 2009 at 5:55 PM, Yusuf T. Mobile <<mailto: >> yusuf.s...@t-mobile.com>yusuf.s...@t-mobile.com> wrote: >> >> >> "Connection refused" is a standard TCP error, not Android-specific. So >> see if you can telnet into the same IP address and port, using a PC on >> the same subnet as your phone, if possible. For example, if you can >> put both the PC and phone are on the same WiFi network. >> >> >> Yusuf Saib >> Android >> ·T· · ·Mobile· stick together >> The views, opinions and statements in this email are those of the >> author solely in their individual capacity, and do not necessarily >> represent those of T-Mobile USA, Inc. >> >> >> >> >> >> On Jul 16, 6:19 am, Zeeshan Muhammad <<mailto:genx...@gmail.com> >> genx...@gmail.com> wrote: >> >>> i have the similar problem, >>> >>> my main java class listening a server socket at port 8088 >>> >>> now when my client (android) try to connect a socket it refused the >>> conenction >>> >>> InetAddress serverAddr = InetAddress.getByName("127.0.0.1"); >>> Socket socket = new Socket(serverAddr , 8088 ); >>> >>> java.net.ConnectException: >>> >> >> > /<http://127.0.0.1:8088>127.0.0.1:8088<< >> http://192.168.0.173/192.168.0.173:7000> >> http://192.168.0.173/192.168.0.173:7000> >> >>> Connection refused >>> >>> >> > anybody help plz >> >>> >>> On Sun, Apr 26, 2009 at 7:53 PM, Rande Arievilo Moreira < >>> >>> >>> >>> >> > <mailto:randeariev...@gmail.com>randeariev...@gmail.com> wrote: >> >>> >>> > Hi Ask, >>> >>> > I'm developing the same application with Lillian. After debugging a >>> > little bit, I found out that we're receiving the following exception: >>> >>> > java.net.ConnectException: < >>> http://192.168.0.173/192.168.0.173:7000>192.168.0.173/192.168.0.173:7000- >>> > Connection refused >>> >>> > 192.168.0.173 is the IP of my machine (the server) in the Local >>> > Network. >>> > Any suggestion? >>> >>> > Thanks. >>> >>> > On Apr 7, 9:21 am, Ask <<mailto:asifk1...@gmail.com> >>> asifk1...@gmail.com> wrote: >>> > > Can you send the exception you are getting or some code snippets, >>> >>> > > it can be some io exception... >>> >>> > > On Apr 7, 4:58 pm,LillianBrandão <<mailto:lbrolive...@gmail.com> >>> lbrolive...@gmail.com> wrote: >>> >>> > > > I've already done at the server machines: >>> > > > redir add tcp:7000:7000. >>> >>> > > > -- >>> > > >LillianBrandão >>> >>> > > > On Tue, Apr 7, 2009 at 8:47 AM, Ask <<mailto:asifk1...@gmail.com> >>> asifk1...@gmail.com> wrote: >>> >>> > > > > Have you done port forwarding at server machine?? >>> >>> > > > > Any message which is coming to the server should be redirected >>> > towards >>> > > > > the emulator port : 7000 >>> >>> > > > > On Apr 7, 4:35 pm,LillianBrandão <<mailto:lbrolive...@gmail.com >>> >lbrolive...@gmail.com> wrote: >>> > > > > > Hi all, >>> >>> > > > > > I have an application client/server and I want to install this >>> > > > > application >>> > > > > > in differente machines. The server is located in IP_SERVER, >>> > listening >>> > > > > port >>> > > > > > 7000. >>> > > > > > I want to start a cliente in another machine with IP_Y and >>> connect >>> > to the >>> > > > > > server on the different machine. >>> >>> > > > > > I've started the server and I've created the socket like this: >>> > > > > > ... new ServerSocket(7000); >>> >>> > > > > > I've started the client and I've created the socket like this: >>> > > > > > ...new Socket(SERVER_IP, 7000) >>> >>> > > > > > But the client did not connect to the server. I've already set >>> the >>> >> > > > > > > INTERNET_PERMISSION. >> >>> > > > > > Any suggestions how to do it? >>> > > > > > Anybody else have already done a client/server application >>> that >>> > > > > communicate >>> > > > > > between differente machines? >>> >>> > > > > > Thanks in advance, >>> > > > > >LillianBrandão.- Hide quoted text - >>> >>> > > > - Show quoted text - >>> >> >> >> >> >> > > > -- > jason.software.particle > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---