I'm trying to get a simple UDP-server to work on an LM3S8538 stellaris arm.
TCP works great, but my UDP server initialized by:
pcb = udp_new();
udp_bind(pcb, IP_ADDR_ANY, 1338);
udp_recv(pcb, myUDPrcv, NULL);
always returns ICMP "destination unreachable (port unreachable)"
messages when I try to send a package to it.
In die config file I only defined LWIP_UDP - is there anything else that
needs to be configured?
I don't have any idea left to try...it's really simple but still doesn't
work ;)
Any suggestions or anything I can try or have a look at are welcome,
Thanks,
Kai
_______________________________________________
lwip-users mailing list
lwip-...@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users
Your UDP code looks fine to me. I suggest tracing a received packet
through the stack (e.g. by turning on some of the debugging code that
prints stuff out) and seeing where the packet gets dropped (or if it
never reaches lwIP at all).
Kieran
This makes no sense to me.
Kieran
No, you shouldn't be setting internal state of the PCB directly.
udp_bind() will set the local ip and port fields, udp_connect() will set
the remote ip and port fields, but without a udp_connect() you should be
able to receive traffic (I think).
> Hey!
>
> I'm trying to get a simple UDP-server to work on an LM3S8538 stellaris arm.
>
You talk about a server? A server sends data to something else.
Looking at the code you seem to be trying to receive UDP data ie client!
Are you clear which one you are doing?
Chris.
> TCP works great, but my UDP server initialized by:
>
> pcb = udp_new();
> udp_bind(pcb, IP_ADDR_ANY, 1338);
>
> udp_recv(pcb, myUDPrcv, NULL);
>
> always returns ICMP "destination unreachable (port unreachable)"
> messages when I try to send a package to it.
>
> In die config file I only defined LWIP_UDP - is there anything else
> that needs to be configured?
>
> I don't have any idea left to try...it's really simple but still
> doesn't work ;)
>
> Any suggestions or anything I can try or have a look at are welcome,
> Thanks,
> Kai
>
> _______________________________________________
> lwip-users mailing list
> lwip-...@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
--
---------------------------------------------------------------------------
| Chris Williams EMail ch...@chrydesn.co.uk |
| Web www.chrydesn.co.uk |
| Tel/Fax 01686 688065 |
| Chrysalis Design. Electronics, Computers, Hardware, Software. |
| Design and development to meet all your needs. |
---------------------------------------------------------------------------
The distinction between server and client is always a difficult one, as
both involve sending and receiving, but a server will typically first
receive a request, then send its response, with a client the other way
round. I think their server is trying to receive the request and
failing.
Kieran
first, let me thank you all for your help :)
And yes, Kieran is right, my "server" should be able to receive commands
or requests and should answer with anything appriopriate to that. In my
understanding this would make it a server ;)
@Marcos: doesn't work, but this values are definitively written in
udp_bind...
@Kieran: tracking a packet through debug-outputs is kind of difficult,
as my debug outputs are crashing the ARM from time to time (when setting
IP_DEBUG). Setting only UDP_DEBUG i just get a lot of confusing logs
which doesn't seem to be related to the event me sending a debug-packet
to the ARM.
I once got a "UDP: not for us" message, but that was just once.
The outputs for bind are completely chaotic, number encoding doesn't
seem to like me at the moment.
I'll have a look on that soon...
Thanks all,
Kai
I wonder if that is due to some assertion firing. It could be related
to your problem.
> Setting only UDP_DEBUG i just get a lot of confusing logs
> which doesn't seem to be related to the event me sending a
> debug-packet
> to the ARM.
Perhaps you would be better turning off most of the messages, and just
changing the log level of a couple of useful ones so you see those.
That should make it easier to see things that are relevant.
> I once got a "UDP: not for us" message, but that was just once.
>
> The outputs for bind are completely chaotic, number encoding doesn't
> seem to like me at the moment.
> I'll have a look on that soon...
I don't like the sound of that. I think it's worth looking into.