Help with UDP data handler

Jeff Powell <jrpinjapan-/[email protected]>
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
I posted this as part of a different question and nobody answered so I 
will try again as it's own topic.

I have opened a udp socket with a datahandler.
I opened a second udp socket for sending multicast data when values change.
I get a connection, read from client, write back to client.
I get another connection. It does not go to the datahandler.
The main loop runs and multicast data continues to send properly.

What am I missing?

-- code --
     if (!udp_open(&tsock, LOCAL_PORT, 0, 0, dataHandler))
     {
         printf("udp_lst_open failed!\n");
         exit(0);
     }
     else
     {
         printf("Listener %s:%d\n",MY_IP_ADDRESS,LOCAL_PORT);
     }
     if (!udp_open(&usock, MBUS_PORT, resolve(MBUS_ADDRESS), MBUS_PORT, 
NULL))
     {
         printf("udp_open failed!\n");
         exit(0);
     }

...

     while (1)
     {
         idleProcessing();     // where values are processed and 
multicast data is sent as needed.
         tcp_tick(NULL);
     }

...

int dataHandler(int event, udp_Socket *s, ll_Gather *g, 
_udp_datagram_info *udi)
{
     int status;
    char cip[20];
    CARDMSG_S *pkt;
    if(handleUdp)             // stops recursion, does not effect 
handler death
        return 1;
    handleUdp=1;
     if(event == UDP_DH_ICMPMSG)     // from the example
    {
         return 1;
    }
     memset(&replyMsg, 0, sizeof (REPLYMSG_S));
     xmem2root(pktbuf, g->data2, g->len2);
     if(g->len3>0)
         xmem2root(pktbuf+g->len2, g->data3, g->len3);
    pkt=(CARDMSG_S*) &pktbuf;
    inet_ntoa( cip, udi->remip);
    printf("%s:%u Slot %d Type %d Device %d Offset %x Width %x Data %lx 
%lx\n", cip, udi->remport, pkt->cSlot, pkt->cOperation, pkt->cDevice, 
pkt->cOffset, pkt->cDataWidth, pkt->sData.longs[1], pkt->sData.longs[0] );
    status = process_packet(pktbuf);
     replyMsg.eStatus = status;
    printf("Status: %x\n", status);
     udp_sendto(s, (char*) &replyMsg, sizeof(REPLYMSG_S), udi->remip, 
udi->remport);     // straight from the
// even tried this but it does not help either. Returns 1 for NULL or 
bytes recv'd for the incoming socket.
    printf("Sent response %u\n", tcp_tick(NULL));
    handleUdp=0;
     return 1;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.