listen to multiple ports

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

listen to multiple ports

steffen_storck
Hello everybody,

i managed to add mutliple netifs, each with a individual IP adress.
Unfortunately all these netifs only listen to one port. (i can trance the
input through ethernet.c, ip4.c to udp.c where  - of course - the local port
is not the dest-port and the telegram gets dismissed.

is there a way to have all netifs listen to more than one port? (for
example, 30000, 32000 and 42000).

i could simply edit the udp.c and add an array of pcbs, but that feels
wrong.

i looked into the bridgeif.c file but i am not sure if this is what i want.
i don't want to forward the telegram, i only need the udp_callback_fn to be
called.

Danke,
Steffen



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: listen to multiple ports

goldsimon@gmx.de
Am 05.07.2019 um 16:37 schrieb steffen_storck:
> Hello everybody,
>
> i managed to add mutliple netifs, each with a individual IP adress.
> Unfortunately all these netifs only listen to one port. (i can trance the
> input through ethernet.c, ip4.c to udp.c where  - of course - the local port
> is not the dest-port and the telegram gets dismissed.

I don't get it. Netifs don't listen to ports, pcbs do.

>
> is there a way to have all netifs listen to more than one port? (for
> example, 30000, 32000 and 42000).

Bind to local port with ADDR_ANY?

Regards,
Simon

>
> i could simply edit the udp.c and add an array of pcbs, but that feels
> wrong.
>
> i looked into the bridgeif.c file but i am not sure if this is what i want.
> i don't want to forward the telegram, i only need the udp_callback_fn to be
> called.
>
> Danke,
> Steffen
>
>
>
> --
> Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: listen to multiple ports

lwip-users mailing list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I'm sorry, but maybe case is a little exotic.

I need to listen to more than one port but only have one local interface. So I tried to add more pcbs to the list of pcbs with this

struct udp_pcb* upcb = udp_new();
    if (upcb)
    {
      udp_bind(upcb, IP_ADDR_ANY, ports[i]);
       udp_recv(upcb, udp_server_receive_callback, pInst);
    }


But after 4 pcbs, the memory allocation fails. How/where can I increase the size so that 8 pcbs cann be allocated?

Regards and have a nice weekend,
Steffen



- -----Ursprüngliche Nachricht-----
Von: lwip-users <lwip-users-bounces+steffen.storck=[hidden email]> Im Auftrag von [hidden email]
Gesendet: Dienstag, 9. Juli 2019 20:44
An: Mailing list for lwIP users <[hidden email]>
Betreff: Re: [lwip-users] listen to multiple ports

Am 05.07.2019 um 16:37 schrieb steffen_storck:
> Hello everybody,
>
> i managed to add mutliple netifs, each with a individual IP adress.
> Unfortunately all these netifs only listen to one port. (i can trance the
> input through ethernet.c, ip4.c to udp.c where  - of course - the local port
> is not the dest-port and the telegram gets dismissed.

I don't get it. Netifs don't listen to ports, pcbs do.

>
> is there a way to have all netifs listen to more than one port? (for
> example, 30000, 32000 and 42000).

Bind to local port with ADDR_ANY?

Regards,
Simon

>
> i could simply edit the udp.c and add an array of pcbs, but that feels
> wrong.
>
> i looked into the bridgeif.c file but i am not sure if this is what i want.
> i don't want to forward the telegram, i only need the udp_callback_fn to be
> called.
>
> Danke,
> Steffen
>
>
>
> --
> Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


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

________________________________


SEW-EURODRIVE GmbH & Co KG
Kommanditgesellschaft, Sitz: Bruchsal, RG Mannheim HRA 230970
Komplementärin: SEW-EURODRIVE Verwaltungs-GmbH, Sitz: Bruchsal, RG Mannheim HRB 230207

Gesellschafter: Jürgen Blickle, Rainer Blickle
Geschäftsführung: Jürgen Blickle (Vorsitzender), Udo Aull, Dr. Jörg Hermes, Dr. Hans Krattenmacher, Johann Soder, Dr. Jürgen Zanghellini

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.4.2 (Build 502)
Charset: utf-8

wsBVAwUBXY3lROPdlEjxNdWZAQg+qQf/dWN03xWEV4TGCFJhqT8Ry+clGkeqOoPH
tRO5i4JAVQto+gC2Xzv9llF+wTCgg5jjvFV8+cghwj59bJxW8lM1zHTYXCnOEevS
iba+AGjB2EWYDddK/ilMh++XYH64U2aUhqF94zAZKDdRvH8+saGGevgXo6H+oTn6
58dVpEuMCdi/OrBqy7sQSy1hvtkn4zuuUvw9hvmU6TZ6QmmiHc1yVnTRMzrKWASH
Wk8JKYwuVl+esrQgilQWJKCH1j0eerure0AZDZk7qyx+Y4m1AcmjiIdGopH4Zb0v
+/9gU0yVrP/8iux383P2U24Ay5E/PSWnH5oZEDllMyyj20HHub7uVA==
=0I/Y
-----END PGP SIGNATURE-----

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: listen to multiple ports

lwip-users mailing list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


I'm sorry, but maybe case is a little exotic.

I need to listen to more than one port but only have one local interface. So I tried to add more pcbs to the list of pcbs with this

struct udp_pcb* upcb = udp_new();
    if (upcb)
    {
      udp_bind(upcb, IP_ADDR_ANY, ports[i]);
       udp_recv(upcb, udp_server_receive_callback, pInst);
    }


But after 4 pcbs, the memory allocation fails. How/where can I increase the size so that 8 pcbs cann be allocated?

Regards and have a nice weekend,
Steffen



- -----Ursprüngliche Nachricht-----
Von: lwip-users <lwip-users-bounces+steffen.storck=[hidden email]> Im Auftrag von [hidden email]
Gesendet: Dienstag, 9. Juli 2019 20:44
An: Mailing list for lwIP users <[hidden email]>
Betreff: Re: [lwip-users] listen to multiple ports

Am 05.07.2019 um 16:37 schrieb steffen_storck:
> Hello everybody,
>
> i managed to add mutliple netifs, each with a individual IP adress.
> Unfortunately all these netifs only listen to one port. (i can trance the
> input through ethernet.c, ip4.c to udp.c where  - of course - the local port
> is not the dest-port and the telegram gets dismissed.

I don't get it. Netifs don't listen to ports, pcbs do.

>
> is there a way to have all netifs listen to more than one port? (for
> example, 30000, 32000 and 42000).

Bind to local port with ADDR_ANY?

Regards,
Simon

>
> i could simply edit the udp.c and add an array of pcbs, but that feels
> wrong.
>
> i looked into the bridgeif.c file but i am not sure if this is what i want.
> i don't want to forward the telegram, i only need the udp_callback_fn to be
> called.
>
> Danke,
> Steffen
>
>
>
> --
> Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


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

________________________________


SEW-EURODRIVE GmbH & Co KG
Kommanditgesellschaft, Sitz: Bruchsal, RG Mannheim HRA 230970
Komplementärin: SEW-EURODRIVE Verwaltungs-GmbH, Sitz: Bruchsal, RG Mannheim HRB 230207

Gesellschafter: Jürgen Blickle, Rainer Blickle
Geschäftsführung: Jürgen Blickle (Vorsitzender), Udo Aull, Dr. Jörg Hermes, Dr. Hans Krattenmacher, Johann Soder, Dr. Jürgen Zanghellini

* Storck, Steffen <[hidden email]>
* 0xF135D599(L)

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

________________________________


SEW-EURODRIVE GmbH & Co KG
Kommanditgesellschaft, Sitz: Bruchsal, RG Mannheim HRA 230970
Komplementärin: SEW-EURODRIVE Verwaltungs-GmbH, Sitz: Bruchsal, RG Mannheim HRB 230207

Gesellschafter: Jürgen Blickle, Rainer Blickle
Geschäftsführung: Jürgen Blickle (Vorsitzender), Udo Aull, Dr. Jörg Hermes, Dr. Hans Krattenmacher, Johann Soder, Dr. Jürgen Zanghellini

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.4.2 (Build 502)
Charset: utf-8

wsBVAwUBXZLvS+PdlEjxNdWZAQjevgf/UXC3WnrVTbKeo9019D8CTLU8JP4vvBeJ
khDEXBnDlFsSUkHzgtFLBDp3iHPkULbiW5iPjWI58hamHwqkk68+hahuXehD2ujV
LYf1i82mKakQeMP7JID+4GDZ38xLIS6QarM6I4zXnr3xJepqnJly2JDoFluKHvte
fjxaOGKOwRoB02IKy6uUmw5ntxLY1S1RI87PqY3SPmBImAfj79MNtu/JA7LzWA2q
pA2EBD21c7MQPpwzhYmRAsa8WgspI4eLGod9WKjT3uFP1QnsQ2/8RGZr678BIqGP
/XDn9RZjGiW1RahkWRJKoXiBg7ywK3qbqwPqChGysfcqiZFWHcDQiw==
=gjxU
-----END PGP SIGNATURE-----

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: listen to multiple ports

goldsimon@gmx.de
steffen_storck wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> I'm sorry, but maybe case is a little exotic.

No, it's not ;-)

>
> I need to listen to more than one port but only have one local interface. So I tried to add more pcbs to the list of pcbs with this
>
> struct udp_pcb* upcb = udp_new();
>     if (upcb)
>     {
>       udp_bind(upcb, IP_ADDR_ANY, ports[i]);
>        udp_recv(upcb, udp_server_receive_callback, pInst);
>     }
>
>
> But after 4 pcbs, the memory allocation fails. How/where can I increase the size so that 8 pcbs cann be allocated?

Look at MEMP_NUM_*** in opt.h. But don't change opt.h: create your own lwipopts.h instead, overriding the default settings.

Regards,
Simon

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