Properly coded multi client TCP server (threads) ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Properly coded multi client TCP server (threads) ?

Jump to solution
1,118 Views
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 Kudos
Reply
1 Solution
894 Views
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

View solution in original post

0 Kudos
Reply
1 Reply
895 Views
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 Kudos
Reply