Search code examples
c++socketstcpomnet++

Maximum number of TCP connections


I am doing a TCP client - server simulation. In the simulation, I have created 2 clients and 2 servers. And I have programmed that read requests will go to server 1 and write requests will go to server 2. Thus, the client will always renew it's socket and make a new connection to the servers.

However, after the client has made 66561 times of connections to the server, instead of sending request packets, it will just simply send some empty ACK packets.

I expected both the clients to be able to send up to millions of requests, but currently, both the clients are only able to send up to 13k requests. Can anyone give me tips or advices?


Solution

  • Sounds like most previously created connections are still taking the resource (not released from system). From the information you give,

    However, after the client has made 66561 times of connections to the server, instead of sending request packets, it will just simply send some empty ACK packets.

    Looks like about 1000+ connections are released. Probably because of the 2msl time is due. If this is the case, suggest you explicitly release a connect before you create a new one.

    Copy and paste your C/S part code would help the analyse.