Hi, I am trying to use a datagram socket in the client side to send a pocket but with no luck. I have a server running on the machine listening on port 5000. What is wrong with this code? And, does anyone please can write a simpler code to send a packet to DGRAM socket on localhost. I keep getting this error: lamp.c: In function ‘chgStatus’: lamp.c:62: warning: assignment makes pointer from integer without a cast lamp.c:65: error: dereferencing pointer to incomplete type lamp.c:67: error: dereferencing pointer to incomplete type lamp.c:75: warning: passing argument 5 of ‘sendto’ from incompatible pointer type Thanks in advance ~Meitham Code of the method in lamp.c void chgStatus (short status) { int sock, length, n; struct sockaddr_in server; struct hostent *hp; int portno = 5000; char buffer[256]; sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) error("ERROR opening socket"); server.sin_family = AF_INET; hp = gethostbyname("localhost"); if (hp==0) error("Unknown host"); bzero((char *) &server, sizeof(server)); bcopy((char *)hp->h_addr, (char *)&server.sin_addr, hp->h_length); server.sin_port = htons(portno); length = sizeof(struct sockaddr_in); if (status) strcpy(buffer, "C1"); else strcpy(buffer, "C0"); n = sendto(sock, buffer, strlen(buffer), 0, &server, length); if (n < 0) error("ERROR sending to socket"); printf("%s\n",buffer); return; }