AnsweredAssumed Answered

How do I create RTCS application with multiple concurrent connections?

Question asked by Damon Gibson on Feb 4, 2016
Latest reply on Feb 5, 2016 by Carlos_Musich

I have created a Modbus TCP Server application as an MQX task, which runs over RTCS TCP/IP.  This task works very well for a single Modbus TCP Client connection.


It detects a connection via accept(), receives Modbus command packets via recv() and sends Modbus response packets via send().  The task also uses closesocket() to close the connection, when either no Modbus Commands are received (timeout) or by detecting that the Modbus TCP Client has closed the connection.


Since accept() always blocks until a connection occurs, I can't easily modify my task to handle multiple concurrent connections.


What is the best (and simplest) way to handle multiple concurrent TCP connections on the same port (TCP port 502 in this case)?