@Override
        public void run() {
            String message;
            byte[] inByte = new byte[ 2048 ];
            int lengthInByte;

            try {
                SocketAddress sAddr = new InetSocketAddress(IP, port);
                socket= new Socket();
                socket.connect(sAddr, conDelay);
                TcpThread=true;
            } catch (SocketTimeoutException ex) {
                System.out.println("conn Timeout");
                bridge.setConnButon(bridge.getLangValues().get("Connect"), 0);
                return;
            } catch (UnknownHostException ex) {
                //nenalezen DNS,...
                Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
                return;
            } catch (IOException ex) {
                //nepodařilo se spojit
                Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
                return;
            }

            bridge.stopConnTimer();
            bridge.setConnButon(bridge.getLangValues().get("Disconnect"), 1);
            bridge.initProcessDataThread();

            try {
                streamOut = new BufferedOutputStream(socket.getOutputStream());
                //streamIn = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                inputStream = socket.getInputStream();
            }
            catch (IOException ex) {
                //chyba
                Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
            }

            startSendThread();

            //bridge.getProcessData().sendToMcu(ProcessData.mcuDo.stopListen); //reset Cam
            bridge.getProcessData().sendToCam(ProcessData.camDo.reset); //reset Cam

            while(TcpThread) {
            try {
                if (!socket.isConnected()) {
                    System.out.println("Disconnected");
                    break;
                }
                /*if (!streamIn.ready()) {
                  continue;
                }*/
                
                message="";
                try {
                    if ((lengthInByte=inputStream.read(inByte))!=0) {
                        if (lengthInByte==-1) {
                            System.out.println("Disconnected");
                            break; 
                        }

                        for (int i=0; i<lengthInByte; i++) {
                            if (echo) System.out.print((char)inByte[i]);
                            message += (char)inByte[i];
                        }                  
                    }
                }
                catch (SocketTimeoutException e) {
                    System.out.println("Disconnected");
                    break;
                }
if (echo) {
                System.out.print("\nIn: \n" + " - ");
                for (int i=0; i<message.length(); i++) {
                    //System.out.print(message.charAt(i) + ", ");
                    System.out.print(Integer.toHexString(new Integer (message.charAt(i))) + ", ");
                }
                System.out.println("\n");
}
                synchronized (lock) {
                    for (int i=0; i<message.length(); i++) {
                        fifo.add(new Integer (message.charAt(i)));
                    }
                }
              }
              catch (SocketException ex) {
                  //nevypisování chyby při odpojení
                  if (TcpThread) Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
              }
              catch (IOException ex) {
                  TcpThread=false;
                  //chyba
                  Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
              }
              
              try {
                  Thread.yield();
                  Thread.sleep(delay);
              } catch (InterruptedException ex) {
                  //nevypisování chyby při odpojení
                  if (TcpThread) Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
              }
          }

          try {
              // pokud mame skoncit, tak uzavreme otevrene proudy a socket
              //streamIn.close();
              //streamOut.close();
              socket.close();
          } catch (IOException ex) {
              Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
          }
      }