Skip to content

Commit

Permalink
get_ip method modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Khushali Desai committed Apr 23, 2015
1 parent e7d02b6 commit 4ed8397
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Binary file modified a.out
Binary file not shown.
11 changes: 7 additions & 4 deletions dns_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

}
}
Expand All @@ -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)
Expand All @@ -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;
}
}

Expand Down
Binary file modified ser
Binary file not shown.

0 comments on commit 4ed8397

Please sign in to comment.