Reputation: 7422
TCP uses port numbers to identify sending and receiving application end-points on a host, or Internet sockets. Each side of a TCP connection has an associated 16-bit unsigned port number (0-65535) reserved by the sending or receiving application
Now if we want to create tcp connection and keep it alive i cannot go more then 65535
What should be the best strategy to cross the limit 65k?
adding multiple interface can increase the possibility of creating more connection is there any other stategy
Upvotes: 1
Views: 2443
Reputation: 311039
Each side of a TCP connection has an associated 16-bit unsigned port number (0-65535) reserved by the sending or receiving application
No. (1) It is 1-65535, not 0-65535. (2) Client side ports are usually reserved by the operating system, not by the application. (3) There is no such thing as the 'sending or receiving application'. There are client and server applications.
If we want to create tcp connection and keep it alive i cannot go more then 65535
No again. If you want to create connections in a client you cannot create more than 65535 to the same target. if you want to accept connections in a server you can accept as many as you like, subject to the prior limit at the client end in each client.
What should be the best strategy to cross the limit 65k?
65535 is 64k-1, not 65k, and there really isn't any such limit except as above, which isn't any kind of limit in practice. You don't need 64k client connections to the same target.
Upvotes: 1
Reputation: 598039
Just because a port number is limited to 64K value does not mean you are limited to 64K connections maximum. You can connect to the same port on different servers (think of how many websites you visit at a time, they all listen on port 80 or 443), and you can reuse the same local port for multiple connections as long as they are connected to different servers. It is the combination of [LocalIP:LocalPort]+[RemoteIP:RemotePort] that uniquely identifies a TCP connection, so that gives you flexibility to tweak those values to allow more connections.
Upvotes: 0
Reputation: 171246
TCP requires that the tuple (server-ip, server-port, client-ip, client-port) is different for each connection. You can change any one of those to get a new connection. A different server-ip is OK, as is a different client-port. The two port ranges alone give you 2^16*2^16 ~ 4 billion connections.
Upvotes: 1