public void run() {
      BluetoothSocket socket = null;
      // Keep listening until exception occurs or a socket is returned
      while (true) {
        try {

          socket = serverSocket.accept();
          dHandler
              .obtainMessage(
                  SocioPhoneConstants.BT_ACCEPT, "Accept " + socket.getRemoteDevice().getName())
              .sendToTarget();
          sHandler.obtainMessage(SocioPhoneConstants.BT_ACCEPT, servers.size() + "").sendToTarget();
          ServerThread server = new ServerThread(socket, sHandler, dHandler, device_list);
          server.start();
          servers.add(server);

          // TODO : Change below thing...

          // Send a time-sync packet to client
          server.SendData("/5:" + System.currentTimeMillis());

        } catch (IOException e) {
          dHandler.obtainMessage(SocioPhoneConstants.BT_EXCEPTION, e.getMessage()).sendToTarget();
          break;
        }
        // If the connection is accepted
        if (socket != null) {
          // Do work to manage the connection (in a separate thread)
          client_sockets.add(socket);
        }
      }
    }
 public void sendToClients(String value) {
   if (wifiMode) {
     byteTransmitted += tcpManager.sendToClients(value);
   } else {
     Iterator<ServerThread> iter = servers.iterator();
     while (iter.hasNext()) {
       ServerThread s = iter.next();
       s.SendData(value);
       byteTransmitted += value.length();
     }
   }
 }
 public void sendToClientsID(String value) {
   if (wifiMode) {
     for (TCPServerThread t : tcpManager.servers) {
       t.SendData(value + (t.mIndex + 2));
     }
   } else {
     Iterator<ServerThread> iter = servers.iterator();
     while (iter.hasNext()) {
       ServerThread s = iter.next();
       s.SendData(value + (s.mIndex + 2));
     }
   }
 }