gartnera/headunit

Alternate Phone Gateway IP retrieval for AA Wifi Access

Opened this issue · 1 comments

EQMOD commented

Here is a much simpler approach of retrieving the Phone's IP address instead of externally saving it as config file;

  FILE* ffile = popen("netstat -rn|awk '$2~/192\\.168\\.43\\.[0-9]{1,3}/ {print $2}'", "r");
  pbuffer[0] = 0;
  fgets(pbuffer, 100, ffile);
  pclose(ffile);


  cli_addr.sin_addr.s_addr = inet_addr(pbuffer);

OMG thank you I have been trying to figure this simple thing out but I am not great at C++. I kind of don't even understand what you are doing at first glance so can you make a pull request?