Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Junfeng Hu
Hi All, I'm trying to leverage my core i5 to send more UDP packets with multiprocssing, but I found a interesting thing is that the socket.bind is always reporting 10048 error even the process didn't do anything about the socket. Here is the script import threading,socket,random,pp,os import

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Junfeng Hu
I did a test on linux, it works well, so the issue is related to os. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Chris Angelico
On Fri, Nov 18, 2011 at 9:23 PM, Junfeng Hu hujunf...@gmail.com wrote: Hi All, I'm trying to leverage my core i5 to send more UDP packets with multiprocssing, but I found a interesting thing is that the socket.bind is always reporting 10048 error even the process didn't do anything about the

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Junfeng Hu
Thanks Yes, I had tried this before, so you could find that I comment the line sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) Here is the results. D:\Python testmythread2.py Traceback (most recent call last): File string, line 1, in module File

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Junfeng Hu
And actually ,the socket hadn't been used in this script. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Chris Angelico
On Sat, Nov 19, 2011 at 2:51 AM, Junfeng Hu hujunf...@gmail.com wrote: And actually ,the socket hadn't been used in this script. Doesn't matter that you haven't used it; you're binding to the port, that's what causes the 10048. I think the main problem is that you're trying to share sockets

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Junfeng Hu
Hi Chris. The socket only binded once. That's the problem I'm puzzleing, I think it may a bug of multiprocessing in windows, or something I missed. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Chris Angelico
On Sat, Nov 19, 2011 at 3:11 AM, Junfeng Hu hujunf...@gmail.com wrote: Hi Chris. The socket only binded once. That's the problem I'm puzzleing, I think it may a bug of multiprocessing in windows, or something I missed. I don't know how multiprocessing goes about initializing those

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread MRAB
On 18/11/2011 15:48, Junfeng Hu wrote: Thanks Yes, I had tried this before, so you could find that I comment the line sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) Here is the results. D:\Python testmythread2.py Traceback (most recent call last): File string, line 1, inmodule

Re: Why sock.bind is always report 10048 error when in a script with multiprocessing

2011-11-18 Thread Junfeng Hu
On Nov 18, 10:55 am, MRAB pyt...@mrabarnett.plus.com wrote: On 18/11/2011 15:48, Junfeng Hu wrote: Thanks Yes, I had tried this before, so you could find that I comment the line sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) Here is the results. D:\Python