How to impement and use Web-server and TCP-Client at the same time using uIP?

Hi,

I am running my LPC1769 on my custom board with FreeRTOS kernel 10.3.1.
I have implemented uIP comes with samples recently. I have already implemented my own requirements. It works as Web-server for the time being.

My ultimate goal is to give two responsibilities to uIP part rather than only doing Web-server.

  1. Web-server for setting up my device from a web interface.
  2. TCP-Client in order to send device requests to a TCP Server on the network.

And I want to be able to adjust their ports individually or at least TCP-Client side.

I assume, it would be just creating another uIP task as I did for the Web-server.
Would you please provide me with some direction regarding how this can be achieved or even reliably possible?

I appreciate your inputs from now.

Best Regards,
Sener

This seems to be question on how to use uIP, and if so, I don’t think a forum dedicated to the FreeRTOS kernel will be the best place to ask it. I would say, that although it is probably nearly a decade since I used uIP, I think it can do what you want ‘out of the box’. The incoming HTTP server connections and outgoing TCP/IP client connections are different connections on different ports, so you don’t have any choice but to use different port numbers for both (which is what I’m interpreting “adjust their ports individually” means). As uIP relates to FreeRTOS, be careful how you access uIP from multiple threads, it is not thread safe.

Thank you for your reply. I am having difficulty to ask where and what, please bear with me, I am still stranger to FreeRTOS.org.
You can consider I am still learning uIP in FreeRTOS. I keep studying FreeRTOS on several documents. But, I can’t find much of use cases and sample codes. Maybe it is me and don’t know where to look.

From your answer, I understand it is doable (double task on uIP). But I don’t know how to be careful about how I access uIP from multiple threads. In that saying, multiple thread means multiple task?

uIP is a fantastic TCP/IP stack, in case you have a 8-bit MCU with 32 KB of RAM or less.

If your processor (LPC1769) is bigger that that, I would recommend to use either lwIP ( the big brother of uIP ), or FreeRTOS’ own TCP/IP stack called FreeRTOS+TCP, which can be found here.

If you have any questions about FreeRTOS+TCP, you can ask them here.

Wish you good luck with it.

Hi Hein,

Thanks a lot for your input, very much appreciated. I will definitely look the other TCP/IP stack alternatives as you pointed since my project is still in early stage.

Besides, can I conclude about using multiple IP protocols under one of these TCP/IP stacks are possible by just creating another tasks and some other relevant functions around it?

For example, I have this line in main and I can make a web-server available with my device using uIP;

xTaskCreate( vuIP_Task, “uIP”, mainBASIC_WEB_STACK_SIZE, ( void * ) NULL, mainUIP_TASK_PRIORITY, NULL );

If I also want to add TCP-Client or whatever else, is it just matter of creating another task similar to the one above? This is maybe a silly question but for me a road blocker until get a clear understanding.