def notifyIdeaStart()

in sbt-idea-compiler-indices/src/main/scala/org/jetbrains/sbt/indices/IntellijIndexer.scala [111:125]


  def notifyIdeaStart(port: Int, projectBase: String, compilationId: UUID): Option[Socket] = {
    val socket = Try(new Socket("localhost", port))

    socket.toOption.map { s =>
      try {
        val in = new DataInputStream(s.getInputStream())
        val out = new DataOutputStream(s.getOutputStream())
        out.writeUTF(projectBase)
        out.writeUTF(compilationId.toString)
        val ack = in.readUTF()
        if (ack != ideaACK) throw new RuntimeException("Malformed response from IDEA.")
        s
      } catch { case e: Throwable => s.close(); throw e }
    }
  }