Error: dereferencing pointer to incomplete type
hi ,
this is the error which i got when compiling a C pgm:
con1.c:471: dereferencing pointer to incomplete type
con1.c:473: dereferencing pointer to incomplete type
this is the code lines which produced the error
int main(int argc, char **argv)
{
char *dev = NULL;
char errbuf[PCAP_ERRBUF_SIZE];
char *fname;
int n;
struct sockaddr_in serv_addr;
struct hostent *server;
pcap_t *handle;
bpf_u_int32 mask;
bpf_u_int32 net;
struct pcap_pkthdr *h;
const u_char *sp;
struct pcap_pkthdr hdr;
pcap_dumper_t *dumpfile;
int num_packets = 5;
front1=NULL;
rear1=NULL;
fname="dump";
// Establishing a connection to the server
if (argc < 3) {
fprintf(stderr,"usage %s hostname port\n", argv[0]);
exit(0);
}
portno = atoi(argv[2]);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
server = gethostbyname(argv[1]);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
// here is the error
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length); //
serv_addr.sin_port = htons(portno);
if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0)
error("ERROR connecting");
......
Any idea.
thanks and regards
cynthia thomas
|