LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-30-2003, 04:31 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Sockets and GUI Trouble


Hi, I would like to know why this part of my code doesnt do anything, no error messages!!, why doesnt list me the open ports? what could be the problem?

Thanks


Code:
    def port(self):
    	   
        try:
	   t = tkSimpleDialog.askstring('INGRESO DE DATOS',               
                                     'Ingrese la IP o HOST:', 
                                     parent=self.TextBox)  
           host = t[1]
           maxport = int(t[2]) + 1

           for port in xrange(1, maxport):
               s = socket(AF_INET, SOCK_STREAM)
               try:
                  s.connect((host, port))
                  self.TextBox.insert(Tkinter.END,"Port %d is open" % port)
               except error:
                   continue
    	except IndexError:
         self.TextBox.insert(Tkinter.END,  "Usage: %s <ip address> <max port>" % t[0])
     	except ValueError:
         self.TextBox.insert(Tkinter.END, "Port must be a valid integer")
     	except Exception, e:
         print e

Last edited by Gerardoj; 12-01-2003 at 12:22 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this python code ? indian Programming 5 09-22-2005 02:20 PM
Getting the web page in python :: What's wrong with the code ? indian Programming 1 09-12-2005 03:17 PM
converting vb6 code to python mrobertson Programming 2 06-02-2005 01:27 PM
easy python code JoeUser11 Programming 1 01-21-2005 01:40 AM
I need a python code that activate a button Linh Programming 0 08-20-2004 10:47 AM


All times are GMT -5. The time now is 09:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration