lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] raw UDP pcb issue(s)


From: Laurent BIERGE
Subject: [lwip-users] raw UDP pcb issue(s)
Date: Mon, 18 Jul 2016 11:09:12 +0200 (CEST)

Hi,

It seems that when i recieve an UDP message, the UDP input function doesn't find the pcb matching with the message recieved.

I have a client that use POSIX socket on my computer and a server that use LWIP on a remote equipment. I already have a raw tcp echo working.
I've used a simple raw udp echo example on the remote equipment, basically:
in udp_init():
                         udp_pcb = udp_new();
                         udp_bind(udp_pcb, addr, port);
                         udp_recv(udp_pcb, udp_echo_recv());
and in udp_echo_recv():
                         udp_sendto();

it didn't worked and after that, i found that most of the time, my messages weren't matching with a local pcb  in udp_input().
So i tried to add specific adresse to udp_bind() and i changed udp_sendto with udp_connect() and udp_send().
I turned ON UDP_DEBUG and it shows me that my pcb is connected and binded to what  i want.

So like i said, most of the time udp_input() don't find matching pcb, but the message is stored.
So when udp_input() manage to match with a local pcb, it calls the callback with the good pcb but with the first pbuf stored.
So basically i got:
send: 1
rcv:...                          ///////// i don't recieve anything, udp_input() doesn't find any pcb matching
.                                   ///////// restarting my UDP client.
send: 2
rcv:....
.
send: 3
rcv:....
.
send: 4
rcv: 1                         ///// miracle ! udp_input() find a match, it empty all the buffers stored with this pcb starting with 1. (my programme isn't designed to rcv several
                                 ////// messages  at once but i know for sure that udp_input calls the callback as many times as it has pbufs stored for this pcb)

So my final question is, why doesn't udp_input() find local match all times ? Why does it work with the fourth time and not before ?

Regards,

Laurent

reply via email to

[Prev in Thread] Current Thread [Next in Thread]