Can someone please tell me whats wrong with this code. It's for a simple proxy server and when I compile it with gcc -c -ansi -pedantic ... I get the error message:
sock.c: In function `main':
sock.c:41: warning: pointer targets in passing arg 3 of `accept' differ in signedness which relates to the accept() command.
------------------------------------------------------------------------------------
PHP Code:
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define BACKLOG 1
main(){
struct sockaddr_in client_add;
struct sockaddr_in my_add;
int portnum = 8080;
char myname[50];
int sockfd, insock;
int sin_size;
gethostname(myname, 50);
printf("started\n");
my_add.sin_family = AF_INET;
my_add.sin_port = htons(portnum);
my_add.sin_addr.s_addr = INADDR_ANY;
memset(&(my_add.sin_zero), '\0',8);
sockfd = socket(AF_INET, SOCK_STREAM,0);
if((bind(sockfd, (struct sockaddr *)&my_add, sizeof(struct sockaddr))) < 0){
printf("dead\n");
}else{
printf("bound\n");
}
if((listen(sockfd, BACKLOG)) < 0){
printf("dies on listen");
}else{
printf("listening\n");
}
sin_size = sizeof(struct sockaddr_in);
insock = accept(sockfd, (struct sockaddr *)&client_add, &sin_size);
}