Ejemplo n.º 1
0
 private void sendMessageUsingTcp(String messageToSend) {
   if (tcpClient == null) {
     // we create a TCPClient object
     tcpClient =
         TCPClient.getTCPClientAndConnect(
             tcpIpAddr,
             tcpIpPort,
             new TCPClient.OnMessageReceived() {
               @Override
               // here the messageReceived method is implemented
               public void messageReceived(String message) {
                 dealWithMessage(
                     message); // TODO: make sure that runs on original thread. (avoid multithread
                 // unsafe access).
                 // publishProgress(message);//this method calls the onProgressUpdate
               }
             });
   }
   // new connectTask().execute(messageToSend);
   tcpClient.sendMessage(messageToSend);
 }