   Problem with C language server/client apps
  Hi,The code for my server is -#include <stdlib.h>#include <sys/types.h>#include <winsock2.h>#include <stdio.h>int main(){WSADATA w;  SOCKET s;struct sockaddr_in server;char buf[512];int rc;if (WSAStartup (0x0202, &w))return EXIT_FAILURE;if (w.wVersion != 0x0202){ // wrong WinSock version!WSACleanup (); // unload ws2_32.dllreturn EXIT_FAILURE;}server.sin_family = AF_INET;server.sin_addr.s_addr = htonl(INADDR_ANY);server.sin_port = htons(12345);s=socket(AF_INET,SOCK_DGRAM,0); //open a UDP socket for useif(bind(s,(struct sockaddr*)&server,sizeof(server))!=0)return EXIT_FAILURE;while(1){rc = recv (s, buf, sizeof(buf), 0);buf[rc]= (char) NULL;printf("Received: %s\n", buf);}return EXIT_SUCCESS;}The code for my client is -#include <stdlib.h>#include <stdio.h>#include <time.h>#include <sys/types.h>#include <string.h>#include <winsock2.h>int main(){SOCKET s;struct sockaddr_in server;struct tm;time_t result,presult;    s = socket (AF_INET,SOCK_DGRAM,0);server.sin_family = AF_INET;server.sin_addr.s_addr = inet_addr("127.0.0.1");server.sin_port = htons(12345);presult = result = time(NULL);while(1) {sendto(s, "HI",2, 0, (struct sockaddr*) &server, sizeof(server));   printf("sleep\n");while(result==presult)result = time(NULL);presult = result;    }return EXIT_SUCCESS;}I run both programs, but the server never responds to the client. Any ideas why?Thanks very much for your help,Barry.   
  For what it's worth, you can try comparing your code to mine (see 2nd post by Anonymous):http://www.gamedev.net/community/forums/topic.asp?topic_id=305860;  The server never accepts a connection, it's just in a loop to recv.   ;  On an unconnected UDP socket you have to call recvfrom(...).   ;  Here's the first three steps by which to debug this problem:1) Is the server binding correctly? Check with netstat after you've started the server.2) Is the client sending correctly? Check your sending output (pause) as well as use Ethereal to make sure the packets go out. Compare addressing to the output of netstat from step 1.3) Is the server receiving anything at all? Put printf()s before and after the call to recv() (you may wish to use recvfrom() in the future, but recv() should work, too; you just lose the identity of the remote end).Of course, first make sure there's no firewall rules getting in the way.