sendError(); send = false;
wait++;  if (wait > 2) { sendError(); send = false; wait = 0; }
                public void run()                {                    while (run)                    {                        try                        {                            if (in.available() > 0)                            {                                char c = (char) in.read();                                sb.append(Character.toString(c));                                if (c == '\n')                                {                                    sb.append(dfi.format(new Date()) + ": ");                                    send = error; //send if this is error                                    // output                                    appendToErrArea();                                }                            }                            else                            {                                if (sb.length() > 0)                                    appendToErrArea();                                if (send)                                {                                    sendError();                                    send = false;                                }                                sleep(2000);                            }                        }                        catch (Exception e)                        {                            //e.printStackTrace(System.err);                        }                    }                    try                    {                        log.close();                    }                    catch (IOException e)                    {                        // TODO Auto-generated catch block                        e.printStackTrace();                    }                }