I am trying to write client for Android which is supposed to
communicate with PC server application on local network.
Server app is written by my friend in C#. Currently there is an iPhone
app that is using this server application with no problems.

I have very simple code for TCP client:

1. Socket s = new Socket(server, port);
2. OutputStream out = s.getOutputStream();
3. PrintWriter output = new PrintWriter(out);
4. output.println("ACTION=Next&VALUE=0&");
5. BufferedReader input = new BufferedReader(new
InputStreamReader(s.getInputStream()));
6. String st = input.readLine();

I went through many TCP implementation examples, and they are all
similar. Pretty much like my code above.
My app freezes on line 6 when I try to read response from the server.
It doesn't cause any errors (no exceptions), nothing shows in
debugger, just timeout error after awhile. Server is supposed to
return string <OK> after executing my action in line 4.
I don't understand why this code hangs. Input is not NULL (I've
checked it). I would expect some exception to be thrown or simply
empty string to be returned.

So? What am I missing? Could it be problem with some special
characters that server app is sending and android can't handle that?
Do I need any special permission in my manifest?

I am positive that I have correct IP address and correct port number.
I can see that on server application running on my PC.

Thanks.

-- 
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

Reply via email to