Specifications
Chapter 18 319
PSA Programming Examples
Using C Over Socket LAN (UNIX)
PSA Programming Examples
  strcat(command, " ");
  } else {
  strcat(command, "\n");
  }
  }
  }
  else
  {
  /* Only <hostname> provided; input on <stdin> */
  strcpy(command, "");
  if (optind > argc)
  {
  usage(basename);
  exit(1);
  }
  }
 }
 else
 {
  /* no hostname! */
  usage(basename);
  exit(1);
 }
 /**********************************************/
 /* open a socket connection to the instrument */
 /**********************************************/
#ifdef WINSOCK
 if (init_winsock() != 0) { 
  exit(1); 
 }
#endif /* WINSOCK */
 instSock = openSocket(destination, SCPI_PORT);
 if (instSock == INVALID_SOCKET) {










