Properly coded multi client TCP server (threads) ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Properly coded multi client TCP server (threads) ?

跳至解决方案
1,116 次查看
robroz
Contributor III

Hi,

I'd like to implement TCP server that would allow more than one client to connect on TCP socket.

First question is how server figures out that client has disconnected ?

Second is how to write robust TCP server that would allow connection of more than one client.

Are threads optimal solution? What to put in those threads?

I'd kindly ask if anyone is also willing to post some code examples...

Regards,

Bulek.

0 项奖励
回复
1 解答
892 次查看
DavidS
NXP Employee
NXP Employee

Hi Bulek,

By default the MQX examples using Ethernet (MQX4.0/demo/web_hvac or the MQX4.0/rtcs/examples/httpsrv) can have more than one client access them.

The default setting for the RTCSCFG_TCP_MAX_CONNECTIONS is 0 (which means there is no limit).

If you want to change this #define setting do it in the user_config.h header and recompile the RTOS components.

Obviously an infinite number of connections cannot occur.  Just realize each connection used up a certain amount of RAM and sooner or later you will run out.

Regards,

David

在原帖中查看解决方案

0 项奖励
回复
1 回复
893 次查看
DavidS
NXP Employee
NXP Employee

Hi Bulek,

By default the MQX examples using Ethernet (MQX4.0/demo/web_hvac or the MQX4.0/rtcs/examples/httpsrv) can have more than one client access them.

The default setting for the RTCSCFG_TCP_MAX_CONNECTIONS is 0 (which means there is no limit).

If you want to change this #define setting do it in the user_config.h header and recompile the RTOS components.

Obviously an infinite number of connections cannot occur.  Just realize each connection used up a certain amount of RAM and sooner or later you will run out.

Regards,

David

0 项奖励
回复