Tuesday, July 28, 2009

Can someone help me with client server error?

i am trying to complie this client.c using gcc -lsocket client.c





but i get these error:


warning: incompatible implicit declaration of built-in function 'bzero'


warning: incompatible implicit declaration of built-in function 'bcopy'


passing argument 2 of 'connect' from incompatible pointer type


warning: incompatible implicit declaration of built-in function 'strlen'





here is the code below:


#include %26lt;stdio.h%26gt;


#include %26lt;stdlib.h%26gt;


#include %26lt;sys/types.h%26gt;


#include %26lt;sys/socket.h%26gt;


#include %26lt;netinet/in.h%26gt;


#include %26lt;netdb.h%26gt;





void error(char *msg)


{


perror(msg);


exit(0);


}





int main(int argc, char *argv[])


{


int sockfd, portno, n;


struct sockaddr_in serv_addr;


struct hostent *server;





char buffer[256];


if (argc %26lt; 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 %26lt; 0)


error("ERROR opening socket");

Can someone help me with client server error?
You have the same problem as this person:





http://www.thescripts.com/forum/thread21...


No comments:

Post a Comment