title: Sending TCP/IP command using socket
body: <p>I am completely new to Java and slowly learning the basics so apologies if this sounds idiotic. </p>
  
  <p>I am trying to create an application that on a button click it sends a specific command to a certain IP and Port. The port will be fixed at Port 32, but the IP will be taken from an Intent. </p>
  
  <pre><code>public class IPControl extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      // Get the message from the intent
      Intent intent = getIntent();
      String message = intent.getStringExtra(IPEntry.ACTUALIP);
  </code></pre>
  
  <p>This is as far have gotten.</p>
  
  <p>It will need to connect to the IP send a command of "Root" (Username) and then wait for a reply then send another command 'Root' (Password) and then wait for another reply, then after the connection has been established, I want to be able to send further commands on button click. </p>
  
  <p>I have been racking my brains and searching the web for days and cannot seem to find the right solution. </p>
  
  <p>I am going to be learning Java properly, it is on my list of things to do but this is vital for me to complete first.</p>
  
  <p>If someone could help it would be extremely appreciated. </p>