Got a barebones Qt UI up, and got stuff writing in the message log.
This commit is contained in:
parent
88f29def56
commit
4d6ff1e9f8
5 changed files with 88 additions and 101 deletions
23
dns.cpp
Normal file
23
dns.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "dns.h"
|
||||
|
||||
PRErrorCode LookupName(char *hostname, PRNetAddr *result) {
|
||||
// Attempt to resolve a name.
|
||||
PRAddrInfo *addrInfos = PR_GetAddrInfoByName(hostname, PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
|
||||
void *iter = nullptr;
|
||||
// PRNetAddr firstAddr;
|
||||
// PRNetAddr tempAddr;
|
||||
// do {
|
||||
iter = PR_EnumerateAddrInfo(iter, addrInfos, 0, result);
|
||||
char ipString[80];
|
||||
PRStatus status = PR_NetAddrToString(result, ipString, 75);
|
||||
if(status == PR_FAILURE) {
|
||||
const PRErrorCode err = PR_GetError();
|
||||
fprintf(stderr, "Error: Converting PRNetAddr to string %d: %s\n",
|
||||
err, PR_ErrorToName(err));
|
||||
return err;
|
||||
}
|
||||
printf("Found IP Address: %s\n", ipString);
|
||||
return 0;
|
||||
// break;
|
||||
// } while(iter);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue