   UDP broadcast... 1 second delay
  Hello, All!I have an OGL application built as a master\slave system.  The master application communicates with an I\O box via serial communications.  The master takes queues from this I\O box and transfers the information via UDP broadcast sockets over the LAN to all slave computers.  It allows me to display an unlimited number of viewpoints around the master's view.  Anyway, I am getting a one second delay from the master to the slaves over the ethernet.The "MASTER" socket is set as such://SOCKET OPTIONS//setup socket optionsremote.sin_family = AF_INET;remote.sin_addr.s_addr = htonl(INADDR_BROADCAST);remote.sin_port = htons(nPort);//NON-BLOCKING I\O//setup socket for non_blocking I\Oerrcode = ioctlsocket(skSocket, FIONBIO, (u_long *)&noblock);//BROADCAST//set socket for broadcasterrcode = setsockopt(skSocket, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(bool)); //ADDRESS REUSE//set socket for address reuseerrcode = setsockopt(skSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&broadcast, sizeof(bool));//SEND PACKET(different function)//send our packetsentLen = sendto(skSocket, (char *)&HostData, packetSize, 0, (SOCKADDR *)&remote, sizeof(SOCKADDR));//error checkingif(sentLen == SOCKET_ERROR){g_log.Write(LOG_FAILURE, "Error Sending Data (ErrorCode): %i",(int)WSAGetLastError());}The "Slave" socket setup as such://setup slave socket infosaServer.sin_family = AF_INET;saServer.sin_addr.s_addr = htonl( INADDR_ANY );saServer.sin_port = htons( nPort);//setup slave for non_blocking I\Oerrcode = ioctlsocket(skSocket, FIONBIO, (u_long *)&noblock);//set socket for broadcasterrcode = setsockopt(skSocket, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(bool));//set socket for address reuseerrcode = setsockopt(skSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&broadcast, sizeof(bool));//bind the socket (SLAVE ONLY)errcode = bind(skSocket, (SOCKADDR *)&saServer, sizeof(SOCKADDR));//RECEIVE(different function)//receive our packetgotLen = recvfrom(skSocket, (char *)&HostData, packetSize, 0, &from, &len;//error checkingif(gotLen == SOCKET_ERROR){g_log.Write(LOG_FAILURE, "Error Receiving Data (ErrorCode): %i",(int)WSAGetLastError());}I do error checking, but the error check on the send or receive side are never set off.  All of the computers are identical hardware wise.Any idea why I would have a one second delay in the broadcast to the slaves?Thanks for any insight you can offer.J[edited by - Jehsup on February 5, 2004 10:57:35 AM]
  Do I need to set a max send and rcv buffer size even though I wouldn't use most of the buffer? I'm not setting it explicitly like below. Now I just calculate my packet size during initialization and pass this value to sendto and rcvfrom.i.e.int snd_buff = 1024*1024;int rcv_buff = 1024*1024;errcode = setsockopt(skSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rcv_buff, sizeof(int));errcode = setsockopt(skSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_buff, sizeof(int));Or do I need to do like above and just set snd_buff and rcv_buff to 188 (my packet size in bytes)?  Or would this matter one way or the other?J [edited by - Jehsup on February 5, 2004 12:51:36 PM];  Hehe,Just in case anyone wondered, it wasn''t my code at all.  It was my supervisor''s.  He had me add an intermediate layer between my code and the I/O box that would allow the user to select between serial or ethernet (from I/O box to master) communication.  It was his ethernet code not mine that was hosing up the works.  LOL, and he''s never wrong =).Later,J 