Re: [Tutor] python sockets

2014-06-11 Thread Jon Engle
Ok, so after making the changes the code does bind the startingPort variable but that is the only port that gets bound. Also when connecting to the startingPort I receive the following error: Please enter starting port: 65520 listening... ...connected! Traceback (most recent

Re: [Tutor] python sockets

2014-06-11 Thread Jon Engle
Ok, so when I run the code it immediately terminates and never 'listens' to the ports in the loop. I have verified by running netstat -an | grep 65530 and the startingPort is not binding. ***Server*** Jons-Mac:Desktop Jon$ python response.py Please enter starting port: 65530 Jons-Mac:Desktop

Re: [Tutor] python sockets

2014-06-11 Thread Alan Gauld
On 11/06/14 00:08, Jon Engle wrote: Ok, so when I run the code it immediately terminates and never 'listens' This has nothing to do with your immediate problem but... ***Code*** #!/usr/bin/python # This is server.py file from socket import * #import the socket library

Re: [Tutor] python sockets

2014-06-11 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 4:08 PM, Jon Engle jon.en...@gmail.com wrote: Ok, so when I run the code it immediately terminates and never 'listens' to the ports in the loop. I have verified by running netstat -an | grep 65530 and the startingPort is not binding. The problem is that all threads

Re: [Tutor] python sockets

2014-06-11 Thread Peter Otten
Jon Engle wrote: Ok, so when I run the code it immediately terminates and never 'listens' to the ports in the loop. I have verified by running netstat -an | grep 65530 and the startingPort is not binding. As I've already hinted the easiest way to keep your listening threads alive is to use

Re: [Tutor] python sockets

2014-06-11 Thread Peter Otten
Alan Gauld wrote: On 11/06/14 00:08, Jon Engle wrote: Ok, so when I run the code it immediately terminates and never 'listens' This has nothing to do with your immediate problem but... ***Code*** #!/usr/bin/python # This is server.py file from socket import *

Re: [Tutor] python sockets

2014-06-11 Thread Jon Engle
Thank you for your help, this definitely gets me going in the right direction! On Wed, Jun 11, 2014 at 4:16 AM, Marc Tompkins marc.tompk...@gmail.com wrote: On Tue, Jun 10, 2014 at 4:08 PM, Jon Engle jon.en...@gmail.com wrote: Ok, so when I run the code it immediately terminates and never

[Tutor] python sockets

2014-06-10 Thread Jon Engle
I am trying to open ports 1025-65535 with the following code (Mostly found online with small modifications). I am unable to bind anything other than the one port which is selected as input. What am I missing and how do I bind all the ports simultaneously? #!/usr/bin/python # This is

Re: [Tutor] python sockets

2014-06-10 Thread Lukas Nemec
Hi, fist - are you really triyng to have open 64 000 ports? ok, i suppose you have your reasons, but this is not a good idea - you'll block most applications that use these ports .. The problem is with your main function - you have PORT defined, but it is not global, it is only local, and

Re: [Tutor] python sockets

2014-06-10 Thread Alan Gauld
On 10/06/14 00:33, Jon Engle wrote: I am trying to open ports 1025-65535 with the following code Why would you want to do that? It sounds like a great way to cripple your PC as it runs 64000 threads monitoring each of those ports. And it assumes that nothing else is using those ports

Re: [Tutor] python sockets

2014-06-10 Thread Peter Otten
Lukas Nemec wrote: Hi, fist - are you really triyng to have open 64 000 ports? ok, i suppose you have your reasons, but this is not a good idea - you'll block most applications that use these ports .. The problem is with your main function - you have PORT defined, but it is not global,

Re: [Tutor] python sockets

2014-06-10 Thread Matthew Ngaha
On Tue, Jun 10, 2014 at 5:28 PM, Jon Engle jon.en...@gmail.com wrote: startingPort=input(\nPlease enter starting port: ) startingPort=int(startingPort) def setup(PORT): PORT = startingPort#arbitrary port not currently in use There's a conflict with this PORT

Re: [Tutor] python sockets

2014-06-10 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 9:28 AM, Jon Engle jon.en...@gmail.com wrote: for port in range (startingPort, 65535): thread.start_new_thread(setup, (port,)) startingPort=startingPort+1 #print startingPort I think you just need this: for port in range (startingPort, 65535):

Re: [Tutor] python sockets

2014-06-10 Thread Marc Tompkins
On Tue, Jun 10, 2014 at 2:00 PM, Jon Engle jon.en...@gmail.com wrote: Ok, so after making the changes the code does bind the startingPort variable but that is the only port that gets bound. Also when connecting to the startingPort I receive the following error: Please enter starting