Skip to content

Instantly share code, notes, and snippets.

@automation-stack
Created February 23, 2016 16:50
Show Gist options
  • Select an option

  • Save automation-stack/79e98b726de1d3cc2148 to your computer and use it in GitHub Desktop.

Select an option

Save automation-stack/79e98b726de1d3cc2148 to your computer and use it in GitHub Desktop.
How to make 600k concurrent connections on a single PC

An IP can only issue most 65536 connections to a server, since socket port is unsigned short. But we can bypass this limit. On Linux, it’s quite easy to set up virtual network interface:

for i in `seq 200 230`; do sudo ifconfig eth0:$i 192.168.1.$i up ; done

Then your computer have many IPs, from 192.168.1.200 to 192.168.1.230. The server bind to 0.0.0.0@port, the client can connect 192.168.1.200@port, or 192.168.1.201@port, etc. Per IP can have about 60K concurrent connections. Then the client can issue as many concurrent connections as it needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment