Thanks for the responses.  Serene is spot on, sending a newline
character does the trick.  My while loop continues execution if a
newline character is received and within the while loop I added a
check for this and break out of it to continue code execution.  Thank
you all again for the help!

On Nov 2, 5:50 am, serene <[email protected]> wrote:
> From the .net socket , canu try to send the message with a new line
> character at the end of message. ??
>
> On Nov 1, 1:39 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

Reply via email to