port check

noprianto opennopri at yahoo.com
Fri Aug 24 06:26:33 CEST 2001

Hello pythonia,

I learn to make a program acts like port checker, so
if someone try to connect by by tcp, i always know.

So far, i have made a program that only can check for
one port. This is my code is you care :

#!/usr/bin/env python

import socket
import sys
import traceback

PORT = 10000

def main():
	serverSocket = socket.socket(socket.AF_INET,
	while 1:
		conn, addr = serverSocket.accept()
		print addr , ' connected at port ' , PORT

if __name__=='__main__':
But when i change PORT to 21 for example, it said
permission denied. I heard that port below 1024 is
restricted only for root. I'm using linux.

So anyone can help me how to make a little port
scanning ? Is it hard ? Please give me a little codes,
i'm newbie but serious !

You have my thanks.

Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger

More information about the Python-list mailing list