private int _read(byte[] paBuffer, int pnOffSet, int pnCount) throws IOException {
   int lnReadPos = 0, lnBytes = 0, lnReadTimeout = 0;
   do {
     /*
      * read data from the socket while the readed byte
      * count is lower than pnMinBytes
      */
     try {
       lnBytes = m_oRead.read(paBuffer, pnOffSet + lnReadPos, pnCount - lnReadPos);
       if (lnBytes >= 0) lnReadPos += lnBytes;
       else
         throw new IOException(
             "Socket IO Exception "
                 + lnBytes
                 + "("
                 + lnReadPos
                 + " of "
                 + pnCount
                 + " bytes readed, No Data)");
     } catch (IOException e) {
       lnReadTimeout++;
       if (lnReadTimeout > 60) throw e;
     }
   } while (pnCount > lnReadPos);
   Logfile.Data("RxD", paBuffer, lnReadPos);
   return lnReadPos;
 }
 private void rewrite() {
   try {
     Logfile.Data("TxD", m_aSent, m_aSent.length);
     m_oWrite.write(m_aSent);
   } catch (IOException e) {
     System.out.println("Write Failed");
   }
 }
 private void write(byte[] paData) {
   try {
     Logfile.Data("TxD", paData, paData.length);
     m_aSent = paData;
     m_oWrite.write(paData);
   } catch (IOException e) {
     System.out.println("Write Failed");
   }
 }