[android-developers] Re: TCP problem - hangs when reading server's response

2010-11-14 Thread bobetko
The server app was written for iPhone witch maybe handle some things differently. As a message terminator server app author used sequence (I will ask him why), so I definitely couldn't use readLine(). It turned out there was more then one problem. In line 4, I had to replace all & characters with

Re: [android-developers] Re: TCP problem - hangs when reading server's response

2010-11-14 Thread Kostya Vasilyev
Another way to debug this is: Run your code in the emulator, and run a tcp/ip protocol sniffer on the host computer at the same time (WireShark, etc.) See if any traffic is getting to the server at all, and what it sends to the client. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 14.11.2

Re: [android-developers] Re: TCP problem - hangs when reading server's response

2010-11-14 Thread Frank Weiss
I suppose I'm a bit rusty on socket networking, since I've been using mostly HTTP, but let's give it a try. It would be very helpful to determine if the server is actually sending a response. But some possible problems: After the output.println, perhaps it's necessary to flush the output buffer.

[android-developers] Re: TCP problem - hangs when reading server's response

2010-11-14 Thread Hal
The following should work (taken from Jt.InputStream component) It uses read and a buffer. It also checks for maxLenght (which you probably don't need). Keep in mind that read may return less bytes than requested. At least something like this should give you an idea of what is happening (exceptio

[android-developers] Re: TCP problem - hangs when reading server's response

2010-11-14 Thread Kristian
Hi, I have only worked with doing sockets more manually, using bytebuffer(http://onjava.com/pub/a/onjava/2002/09/04/nio.html and ignore non-blocking for now) and then parsing what I need (I guess I still like the C-way of using sockets), so I am not an expert in this field. Anyway, have you checke

[android-developers] Re: TCP problem - hangs when reading server's response

2010-11-13 Thread bobetko
I tried: input.read(); I also tried to read Reader the same way: Reader in = new InputStreamReader(s.getInputStream()); in.read(); Out of desperation I tried to recompile to 2.2 (now is 2.1). -- You received this message because you are subscribed to the Google Groups "Android Developers" group

Re: [android-developers] Re: TCP problem - hangs when reading server's response

2010-11-13 Thread Miguel Morales
Well, you're using ReadLine() are you sure the server is actually sending lines, as in ending with '\n'? You might want to try using the InputStream directly with read(). On Sat, Nov 13, 2010 at 6:18 PM, bobetko wrote: > And one more thing, > Encoding.UTF8 is used. Not sure if that might be impor

[android-developers] Re: TCP problem - hangs when reading server's response

2010-11-13 Thread bobetko
And one more thing, Encoding.UTF8 is used. Not sure if that might be important. -- 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 em