Hi

I'm trying to use socket and UDP (DGRAM) to receive data
from other devices.

        addr.sin_len=sizeof(addr);
        addr.sin_family=AF_INET;
        addr.sin_port=PP_HTONS(MyPort);
        addr.sin_addr.s_addr=PP_HTONL(INADDR_ANY);
        s=socket(AF_INET, SOCK_DGRAM, 0);
        ret=connect(s, (struct sockaddr*)&addr, sizeof(addr));

        ret=read(s, buffer, size);

The calls are all successful, read is waiting. I can see the udp frame coming
in with the right port. However the frame is discarded in udp_input:

      if (pcb->recv != NULL) {
        /* now the recv function is responsible for freeing p */
        pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr(), src);
      } else {
        /* no recv function registered? then we have to free the pbuf! */
        pbuf_free(p);
        goto end;
      }

Of course I don't have a callback as I have a thread waiting for the data.
Is this even possible? Do I need to use listen instead? From the general
socket docu it should also work with read.

Thanks

bye  Fabi


_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to