Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python)': 0.05; 'derived': 0.09; 'key.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'unittest': 0.09; 'thread': 0.14; '"in': 0.16; "(it's": 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:handling': 0.16; 'subject:problems': 0.16; 'supress': 0.16; 'tcp': 0.16; '(not': 0.18; 'basically': 0.19; 'example': 0.22; 'header:User-Agent:1': 0.23; 'header:X -Complaints-To:1': 0.27; 'writes:': 0.31; 'this.': 0.32; 'option': 0.32; 'run': 0.32; 'maybe': 0.34; 'subject:with': 0.35; 'problem.': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'method': 0.36; 'charset:us-ascii': 0.36; 'wrong': 0.37; 'server': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'received:217': 0.63; 'address': 0.63; 'taking': 0.65; 'details,': 0.68; 'reliability': 0.84; 'shutdown': 0.84; 'subject:, ...': 0.84; 'use"': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: xmlrpc: problems with socket handling, close, shutdown of server, TIME_WAIT, ... Date: Wed, 07 May 2014 08:43:16 +0200 References: <01237970-87cd-4d29-a944-09e64b8efeee@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0ac36.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:wzRmzC/HWArJTIyNJeVvVwsOBEI= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399445018 news.xs4all.nl 2944 [2001:888:2000:d::a6]:43290 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71008 thomas.lehmann.private@googlemail.com writes: > ... > taking the xml-rpc derived from standard example is working - basically - but with following scenario I do not understand the problem. Maybe you can help: > > - one Unittest that does create the xmlrpc server in a thread > in "setUp" and shutdown of it in tearDown. > The xml-rcp server does store/load a value for a key. > (It's for testing/learning purpose) > > Problem(s): > > - If I run the test method twice (copy and paste and rename) > then I get a "error: [Errno 98] Address already in use" > (I assumend the tearDown would have closed all sockets) For reliability reasons (their might be (communication) packets under way that may arrive at the wrong partner), a port stays "in use" for twice (I think) the maximal packet lifetime after its "shutdown". This is a TCP (not a Python) property. There is a TCP(socket) option to supress this. For the details, consult the TCP specification.