AnsweredAssumed Answered

MQX change socket port when accept() is running

Question asked by DAVID GUTIERREZ on Jul 5, 2017
Latest reply on Jul 6, 2017 by Daniel Chen

Hi,

We are using MQX 4.1 to provide ethernet to a control board with MK60FN1M0 microcontroller. We have implemented a web server, SNMP server and a TCP socket server and we found a problem with the last one when we try to change the port number.

 

We initialize the socket server by using socket(), bind(), listen() and then accept(), as usual. The task holds on accept until client starts a connection. In this situation, we want to change the socket port and restart de original socket from another task.  

 

We have try to send (from another task):

    shutdown(currentTcpSocket,FLAG_ABORT_CONNECTION);

 

but it seems not working. Actually, when we abort the socket and we watch de task list, TCP/IP task shows a "LWMEM_POOL INVALID" error.

 

Please, any help will be appreciate. 

Thank you very much.

Outcomes