[Tutor] python sockets

Marc Tompkins marc.tompkins at gmail.com
Tue Jun 10 23:07:37 CEST 2014


On Tue, Jun 10, 2014 at 2:00 PM, Jon Engle <jon.engle at 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 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
>

Sorry about that!  I should have read the docs
(https://docs.python.org/2/library/thread.html)
for thread.start_new_thread(); you had it right in the code you posted (it
was the rest of your loop that was a problem.)  So, change it back to:


    for port in range (startingPort, 65535):
> thread.start_new_thread(setup, (port,))
>         #print port
>

My apologies for the bum steer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140610/2955ec7b/attachment-0001.html>


More information about the Tutor mailing list