[Tutor] python sockets

Jon Engle jon.engle at gmail.com
Tue Jun 10 23:00:54 CEST 2014


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 call last):

      File "response.py", line 31, in <module>

        thread.start_new_thread(setup(port))

    TypeError: start_new_thread expected at least 2 arguments, got 1


On Tue, Jun 10, 2014 at 4:23 PM, Marc Tompkins <marc.tompkins at gmail.com>
wrote:

> On Tue, Jun 10, 2014 at 9:28 AM, Jon Engle <jon.engle at 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):
>> thread.start_new_thread(setup(port))
>>         #print port
>>
>
> and inside of setup, get rid of this line:
> PORT = startingPort    #arbitrary port not currently in use
>
>


-- 
Cheers,

   Jon S. Engle
   jon.engle at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140610/4ea6fcc9/attachment.html>


More information about the Tutor mailing list