Not sure why I am getting this error message from this code:
error:
test_client.c: In function âmainâ:
test_client.c:22: warning: incompatible implicit declaration of built-in function âprintfâ
test_client.c:23: warning: incompatible implicit declaration of built-in function âexitâ
code:
Code:
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define MYPORT 22
int main(void)
{
int sockfd;
struct sockaddr_in my_addr;
sockfd = socket(PF_INET, SOCK_STREAM, 0);
if ((sockfd=socket(PF_INET, SOCK_STREAM, 0))==-1){ /* calls socket() */
printf("socket() error\n");
exit(-1);
}
}
Can anyone please help me see the light?