title: How accept two kinds of clients on a serversocket?
body: <p>I am developing a server application that will basically forward commands and messages from one client to the other. Those clients are two different applications, though. One is an app on an Android device that serves as a "remote control" to the other.</p>
  
  <p>When booting either of those applications, it will register with the online server, through sockets. Now, my question is: How will my server be able to tell what kind of client it is dealing with after <code>ServerSocket.accept()</code>ing it?</p>
  
  <p>I've come up with two possible solutions:</p>
  
  <p>1: Open two ServerSockets, on two different ports. One application connects to one port, the other application connects to the other.</p>
  
  <p>2: After connecting, the client sends a String containing an identifier of what client they are.</p>
  
  <p>There are probably way more (and better) solutions than these two though, so I'd like to know what you people prefer to do. I'm fairly certain that I'm not the first person to run into this dilemma. :)</p>