title: C Programming - Command Line Arg - Trying to take an IP Address
body: <p>Our assignment is to have a server-client model....</p>
  
  <p>We're supposed to check for a command line arg, if there is not one(argc = 1), we set up as a server.  otherwise we use the argv[1] to setup the client socket...</p>
  
  <p>It seems to run fine if I just use randomness for the argument, but when I try to put an address in, 1.2.3.4 for example, it doesnt give any output, just starts the program and does nothing.</p>
  
  <p>I guess my question is what's the best way to handle a command line argument in the form of an IP address.</p>
  
  <p>Here is my main function.</p>
  
  <pre><code>int main( int argc, char *argv[] )
  {
  
      printf("%i",argc);
      if(argc==1)
      {
              printf("Welcome to the ZOG Virtual Probe Game!  You have choosen to take the role of a server.");
              printf("\nPlease wait for an opponent to connect.");
              runServer();
      }else if(argc==2)
      {
              printf("Welcome to the ZOG Virtual Probe Game!  You are now connecting to specified IP.");
              runClient(argv[1]);
      }else
      {
              printf("You used an invalid command line argument. You can input an IP address or leave no command arg to host a game.");
      }
  }
  </code></pre>