I’ve created a TCP Server inside Q2687 series module and it works fine. I also developed a desktop Client App to connect to the Server. I can connect to the Server with multiple Celient App at the same time. For some reason, I need to send data to all “connected TCP Clients” from the Server but I could not find an API or command for this. Is there any way to do this? (This is the main problem, if there is a way to do it, I won’t use the below method to solve the problem.)
So, I tried to solve the problem with my custom way. There should be used a linked list structure because of automatic list management advantages (add, remove, etc.). I decided to use the list API of Open AT Framework (wm_lst_t) to store TCP Clients’ ID’s to send them data manually. When a Client connect to the Server, I am adding the Client ID to list as follows;
position = wm_lstAddItem ( ListPtr, ev->channel ); //ev->channel gives me an ID like “0x180ce034”
And, when a Client disconnected (by the event WIP_CEV_PEER_CLOSE) or got an Error (by the event WIP_CEV_ERROR), I am deleting the Client from the list as follows;
clientCount = wm_lstDeleteItem ( ListPtr, wm_lstFindItem ( ListPtr, ev->channel ) );
From the above code line, the API wm_lstFindItem should find and give me the ID of current Client that need to be deleted from the list. It doesn’t work It always give 0 as index. (This is my second problem)
Any idea that you give me to solve one of the two problems would be appreciated.
Thanks in advance.