Browsing around the documentation I found this: http://developer.android.com/reference/org/apache/http/conn/EofSensorInputStream.html
2011/11/2 Kumar Bibek <[email protected]> > You need a separate thread for reading. > > *Thanks and Regards, > Kumar Bibek* > * > http://techdroid.kbeanie.com > http://www.kbeanie.com* > > > > > On Tue, Nov 1, 2011 at 11:09 PM, Tonez <[email protected]> wrote: > >> Hi Everyone, >> >> I have a .net c# application acting as a server listening on a >> particular port, and an Android app that I'm building acting as the >> client which will connect and send / receive tcp messages to / from >> the .net server application. I have it working at the moment but am >> faced with a challenge that I'm hoping has a better solution than the >> one I've implemented. My Android app connects to the .net server >> fine, upon successfully connecting the .net application sends back a >> tcp message - my Android app receives this message but it won't >> continue code execution whilst it's reading the connected stream >> unless I close the network stream in the .net server application. >> Below is the bit of code which handles reading / writing to the >> network stream: >> >> out = new PrintWriter( new BufferedWriter( new >> OutputStreamWriter(socketObj.getOutputStream())), true); >> in = new BufferedReader( new >> InputStreamReader( socketObj.getInputStream())); >> >> out.printLn("my command"); >> >> String text = ""; >> String responseStr = ""; >> >> while ((text = in.readLine()) != null) { >> responseStr += text; >> } >> >> So the while loop above continues to execute until I close the network >> stream in the .net app. Is there some way of specifying to the >> Android / Java network stream that the data being sent has ended so it >> can break out that while loop and continue code execution apart from >> closing down the network stream on the .net side? >> >> Thanks for the help. >> >> T >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 株式会社アルゴ ARGO Inc. 〒130-0012 東京都墨田区太平3-11-10 NTKオオノビル8階 ソアレス フランシスコ ( Soares Francisco ) Mail : [email protected] HP : http://www.argo.bz/ TEL:03-5619-4511 FAX:03-5619-4512 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

