Hi, i will try explain what i want and what i did and then what i am facing, What i am trying to do :
- using only one LWIP (tcp-ip) stack - the communication with lwip will be by using RPC calls. - the system should be multi-threading and serve many process in the same time
What I did,
- I created the client - server for the RPC which invoke the lwip methods. I will use the server only . - I created the libc_rpc_lwip plugin which is similar to libc_lwip . in libc_rpc_lwip i have an aobject of the Connection to call the methods. - Since i want only one stack in the i did not initialize the lwip from the constrcutre of the plugin that is mean : Plugin::Plugin() { PDBG("using the RPC lwIP libc plugin\n"); //rpcclient.r_lwip_tcpip_init(); this is commented } and i made the initiation in the RPC server and i used static IP for now ( I don't want to handle the libc_lwip_nic_dhcp right now) and this is the main method in the RPC server
int main(void) { Cap_connection cap;
static Sliced_heap sliced_heap(env()->ram_session(), env()->rm_session());
PDBG("lwip init has been started."); lwip_tcpip_init(); enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 }; lwip_nic_init(inet_addr("10.0.2.18"), inet_addr("255.255.255.0"), inet_addr("10.0.2.1"), BUF_SIZE, BUF_SIZE); PDBG("gotting ip is done.");
enum { STACK_SIZE = 7096 }; static Rpc_entrypoint ep(&cap, STACK_SIZE, "rpclwip_ep");
static rpclwipsession::Root_component rpclwip_root(&ep, &sliced_heap); env()->parent()->announce(ep.manage(&rpclwip_root));
/* We are done with this and only act upon client requests now. */ sleep_forever();
return 0; }
- for testing i am using simple echo server and make it configure it to use the libc_rpc_lwip insread of libc_lwip and i was succeeded .
What I am Facing:
- when i tried to run more then one echo server ( in different port) ,the lwip is not working will and what i found that when the tow echo server try to accept connection the first one will block the other. and it means that lwip is not multi threading any more. Is the RPC prevent the lwip multi-threading or I am doing some thing wrong . I maنe my problem easy to be understood, if not just ask me to clarify.
Thank you in advance