MQX change socket port when accept() is running

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX change socket port when accept() is running

626件の閲覧回数
David_g1
Contributor I

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.

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

451件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

I noticed this issue happens when you change/restart the socket from another task,  could you please check if this issue happens if you change/restart the socket from the same task?

0 件の賞賛
返信

451件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi David:

Typically, a task is set to MQX_LWMEM_POOL_INVALID state when calling LWMEM related API. Please refer to the following code in lwmem.c

Since you are shutting down the socket, RTCS will immediately discard the socket and the socket's internal send and receive buffers. I would suggest you place a break point at the line where _task_set_error(MQX_LWMEM_POOL_INVALID) is located. And when it stops there, I guess you can get some information for analysis.

pastedImage_1.png

Regards

Daniel

0 件の賞賛
返信