Skip to content

Commit

Permalink
second entry in file not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Khushali Desai committed Apr 28, 2015
1 parent a502080 commit 38acbfd
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
2 changes: 0 additions & 2 deletions 208DNS.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <stdlib.h>



typedef struct header {
unsigned short id; //16 bit ID
unsigned char qr : 1; //1 bit Query/ Response
Expand Down
Binary file modified abs
Binary file not shown.
Binary file added dns1
Binary file not shown.
4 changes: 2 additions & 2 deletions dns1.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void ngethostbyname(unsigned char *host , int query_type)
long *p;
p=(long*)answers[i].rdata;
a.sin_addr.s_addr=(*p); //working without ntohl
printf("has IPv4 address : %s",inet_ntoa(a.sin_addr));
printf("has IPv4 address : %s",inet_ntoa(a.sin_addr)); // here is the demon second one is down
}

if(ntohs(answers[i].resource->type)==5)
Expand Down Expand Up @@ -296,7 +296,7 @@ void ngethostbyname(unsigned char *host , int query_type)
long *p;
p=(long*)addit[i].rdata;
a.sin_addr.s_addr=(*p);
printf("has IPv4 address : %s",inet_ntoa(a.sin_addr));
printf("has IPv4 address : %s",inet_ntoa(a.sin_addr)); //another demon is here
}
printf("\n");
}
Expand Down
15 changes: 14 additions & 1 deletion dns_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ char host_cl_1[2000];
void get_ip(char *host_cl);
void get_from_external(char* host_cl);
void ChangetoDnsNameFormat(unsigned char*,unsigned char*);
void gettime();
// connect to socket, Thread
//send recv ans
//get servers
Expand Down Expand Up @@ -205,8 +206,9 @@ int main(int argc , char *argv[])
for (j = 0; j < 100; j++) {
dns_servers[i][j] = '\0';
}
}
}// SETTING DNS server field to null

void gettime();
}
}
}
Expand Down Expand Up @@ -282,6 +284,17 @@ void get_ip(char* host_cl)
}

}
void gettime()
{
time_t current_time;
char* c_time_string;

/* Obtain current time as seconds elapsed since the Epoch. */
current_time = time(NULL);
c_time_string = ctime(&current_time);
gets(c_time_string);
printf("Current time is %s", c_time_string);
}


void get_from_external(char* host_cl)
Expand Down
Binary file renamed a.out → ds
Binary file not shown.
4 changes: 3 additions & 1 deletion server_db.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
www.google.com 75.75.76.75
www.facebook.com 78.89.92.90
www.google.com 75.75.76.75

0 comments on commit 38acbfd

Please sign in to comment.