You should process the messages in a Thread. Put your code into a Thread
that calls handler methods when a specific message arrived.
The Thread runs forever and receives all messages and all data...

On Thu, Aug 27, 2009 at 03:22, Michael Yip<[email protected]> wrote:
> Hi guys,
>
> Does anyone know how to know when I've read all the PersistentPut and
> PersistentGet messages at the start? There's no way of knowing how many
> there are and I have no idea how to know when to stop reading? Below is
> the code I've written:
>
>        String line;
>        while((line = buffIns.readLine()) != null){
>            System.out.println(line);
>            _Logger.log(line);
>            //Capture ConnectionIdentifer to be used as salt for file
> insertions
>            if(line.contains("ConnectionIdentifier")){
>                helloID = line.substring(line.indexOf('=') + 1,
> line.length());
>            }
>            if(line.equals("EndMessage")){
>                //Read an extra line to see if there are more to read
>                //Read all persistent puts and gets
>                line = buffIns.readLine();
>                if(line.contains("Get") || line.contains("Put") ||
> line.contains("URI") ||line.contains("Get") || line.contains("Data")
> ||line.contains("Started") || line.contains("Finished")||
> line.contains("Simple")){
>                    System.out.println(line);
>                    _Logger.log(line);
>                }else{
>                    return true;
>                }
>            }
>        }
>
> but obviously the reader doesn't know when to stop and so line is never
> null?
>
> Thanks,
>
> Michael
> _______________________________________________
> Devl mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
>



-- 
__________________________________________________
GnuPG key:   (0x48DBFA8A)
Keyserver:   pgpkeys.pca.dfn.de
Fingerprint:
477D F057 1BD4 1AE7 8A54 8679 6690 E2EC 48DB FA8A
__________________________________________________
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to