Dereferencing error in client socket code?

You haven't included the declaration of gethostbyname.

Up vote 0 down vote favorite 1 share g+ share fb share tw.

Till yday my code was running fine, but today I am getting client. C:61:25: error: dereferencing pointer to incomplete type client. C:63:16: error: dereferencing pointer to incomplete type The lines have been written below again.

Any kind of help would be appreciated. #include #include #include #include #include #include #include #define MAXPROFILES 2 int main(int argc, char *argv) { int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; unsigned char buf1024; struct profile_t { unsigned char length; unsigned char type; unsigned char *data; }; typedef struct profile_datagram_t { unsigned char src4; unsigned char dst4; unsigned char ver; unsigned char n; struct profile_t profilesMAXPROFILES; } header; header outObj; if (argc h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length); serv_addr.sin_port = htons(portno); printf("Client 1 trying to connect with server host %s on port %d\n", argv1, portno); if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length);* c sockets link|improve this question asked Jul 27 '11 at 9:00user5376701617 36% accept rate.

Should &serv_addr.sin_addr.s_addr not be serv_addr.sin_addr.s_addr? – leppie Jul 27 '11 at 9:05.

You haven't included the declaration of gethostbyname: #include compile with -Wall warning: implicit declaration of function ‘gethostbyname’ About the error message: the compiler basically tells you that it doesn't know how to access the field of the struct because it never saw the definition of it.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions