A Socket-Operation always blocks, so you have to ensure that you know, 
when the data ends. Your Server-Side should send the length of the 
response first, and then the data. That's what i do when using 
TCP-Sockets. The SocketConnection is a Stream, and therefore normally 
has no "end".

So try sending an int first, which specifies how many bytes will fallow.

Markus

[EMAIL PROTECTED] schrieb:
> hey !
>
> i try to read all the data of an open socket. but i am not able to get all 
> the data till the end.
> can somebody help me ?
>
> my code :
>
> SocketConnection socketConnection = (SocketConnection) 
> serverSocketConnection.acceptAndOpen();
> OutputStream out = socketConnection.openOutputStream();
> InputStream in = socketConnection.openInputStream();
>
> int bytesRead = 0;
> byte[] buffer = new byte[5];
> String data = "";
>
> while((bytesRead = in.read(buffer)) != 0){
>     data += new String(buffer);
> }
>
> System.out.println(data);
>
> i am not getting to the end of the stream.
>
> thx for helping !
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Eclipseme-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/eclipseme-users
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Eclipseme-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/eclipseme-users

Reply via email to