Skip to content

Instantly share code, notes, and snippets.

@andrask
Created December 9, 2015 09:28
Show Gist options
  • Save andrask/d2d14cc0d2b6ee3d3076 to your computer and use it in GitHub Desktop.
Save andrask/d2d14cc0d2b6ee3d3076 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
'''
This is a test script for http://serverfault.com/questions/741633/connection-refused-on-rhel-localhost-with-running-server
'''
import socket
port = 12000
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', port))
serversocket.listen(0)
for i in range(1, 50):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", port))
print i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment