Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'attribute': 0.07; 'subject:when': 0.07; 'reply-to:addr:comp.lang.python': 0.09; 'subject:report': 0.09; 'to:addr:comp.lang.python': 0.09; 'subject:error': 0.10; 'skip:" 40': 0.15; 'cc:addr:python-list': 0.15; 'func(*args)': 0.16; '(most': 0.21; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.23; 'traceback': 0.24; 'cc:2**0': 0.25; 'load': 0.26; 'received:209.85.220': 0.27; 'tried': 0.28; 'cc:addr:python.org': 0.29; 'thanks': 0.31; 'comment': 0.32; 'header:User-Agent:1': 0.33; 'last):': 0.34; 'object': 0.35; 'skip:" 20': 0.35; 'file': 0.36; 'subject:skip:m 10': 0.36; 'could': 0.38; 'subject:with': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'received:209': 0.40; 'here': 0.65; 'family,': 0.67; 'header:Reply-To:1': 0.70; 'reply- to:no real name:2**0': 0.71; 'reply-to:addr:googlegroups.com': 0.73; 'subject:always': 0.84 Newsgroups: comp.lang.python Date: Fri, 18 Nov 2011 07:48:36 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=63.149.188.15; posting-account=dE7OLgoAAADuzLCox6ztdlv7_lgcaiKF References: <12715937.830.1321611809592.JavaMail.geo-discussion-forums@yqoo7> User-Agent: G2/1.0 X-Google-Web-Client: true MIME-Version: 1.0 Subject: Re: Why sock.bind is always report 10048 error when in a script with multiprocessing From: Junfeng Hu To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: comp.lang.python@googlegroups.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1321631319 news.xs4all.nl 6963 [2001:888:2000:d::a6]:36415 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!news.ecp.fr!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15892 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 test>mythread2.py Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\multiprocessing\forking.py", line 347, in main self = load(from_parent) File "C:\Python27\lib\pickle.py", line 1378, in load return Unpickler(file).load() File "C:\Python27\lib\pickle.py", line 858, in load dispatch[key](self) File "C:\Python27\lib\pickle.py", line 1133, in load_reduce value = func(*args) File "C:\Python27\lib\multiprocessing\reduction.py", line 167, in rebuild_sock et _sock = fromfd(fd, family, type_, proto) File "C:\Python27\lib\multiprocessing\reduction.py", line 156, in fromfd s = socket.fromfd(fd, family, type_, proto) AttributeError: 'module' object has no attribute 'fromfd'