Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Created January 24, 2016 00:17
Show Gist options
  • Save radiovisual/308ebe5608d07511797e to your computer and use it in GitHub Desktop.
Save radiovisual/308ebe5608d07511797e to your computer and use it in GitHub Desktop.
Bind a useless process to any port (useful for testing)
import socket
import sys
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
port = sys.argv[1]
# Bind the socket to the port
server_address = ('localhost', int(port))
print sys.stderr, 'starting up on %s port %s' % server_address
sock.bind(server_address)
raw_input("click any key to shutdown...")
@radiovisual
Copy link
Author

Run the file with this command: python bindToUDP.py <port>

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