title: Connect(): WSAECONNREFUSED on connect
body: <p>I am trying to connect to a device using the Connect api. And it is giving me WSAECONNREFUSED error. 
  This happens when I have two devices connected and I try to connect to one of the devices. If I connect only one device then the connectino goes through fine.</p>
  
  <p>Could any one of you let me know the problem here.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>sockaddr_in my_addr;
  
  my_addr.sin_family = (USHORT)AF_INET ;
  my_addr.sin_port = htons((USHORT)host_port);
  
  memset(&amp;(my_addr.sin_zero), 0, (size_t)8);
  my_addr.sin_addr.s_addr = inet_addr(pHostName);
  
  if (connect( (SOCKET)*uiSocket, (struct sockaddr*)&amp;my_addr, 
      sizeof(my_addr)) == SOCKET_ERROR )
  {
      int err = WSAGetLastError();
      fprintf(stderr, "Error connecting socket %d\n", WSAGetLastError());
      closeCxn();
      return false;
  }
  </code></pre>
  
  <p>Thanks.</p>