diff --git a/a.out b/a.out index 82266e0..d0e4cc6 100755 Binary files a/a.out and b/a.out differ diff --git a/dns_main.c b/dns_main.c index f2d5d51..d41fdd9 100644 --- a/dns_main.c +++ b/dns_main.c @@ -201,6 +201,7 @@ int main(int args, char *argv[]) //this is reply ip address , send(sd , host_cl , strlen(host_cl) , 0 ); get_ip(host_cl); + gets(dns_servers[0]); } } @@ -221,7 +222,7 @@ void get_ip(char* host_cl) { FILE *fp; char line[200] , *p; - printf("%s",host_cl); + int i = 0; if((fp = fopen("server_db.txt" , "r")) == NULL) @@ -231,19 +232,21 @@ void get_ip(char* host_cl) while(fgets(line , 200 , fp)) { + printf("%s",line); + if(line[0] == '#') { continue; } - if(strcmp(line , host_cl) > 0) + if(strcmp(line , host_cl) >0 ) { - + gets(host_cl); strcpy(dns_servers[i], strtok(line, " ")); strcpy(dns_servers[i], strtok(NULL, "\n")); ++i; - return; + break; } } diff --git a/ser b/ser index 4c569a9..d0e4cc6 100755 Binary files a/ser and b/ser differ