Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103516

Re: tcp networking question (CLOSE_WAIT)

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "Martin A. Brown" <martin@linux-ip.net>
Newsgroups comp.lang.python
Subject Re: tcp networking question (CLOSE_WAIT)
Date Thu, 25 Feb 2016 10:56:00 -0800
Lines 45
Message-ID <mailman.134.1456426564.20994.python-list@python.org> (permalink)
References <7ff15c67-102e-4b02-a2c8-87b24f1b8351@googlegroups.com> <mailman.133.1456424259.20994.python-list@python.org> <86a8ad2a-3185-4ff3-abe0-7345411fa0c2@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
X-Trace news.uni-berlin.de +HIhfE2cUnZkTZH6+wvW2gloeU6A6zQSWXggCMYwEALQ==
Return-Path <martin@linux-ip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'socket': 0.07; 'subject:question': 0.08; 'cc:addr:python-list': 0.09; 'cleaned': 0.09; 'incorrect': 0.09; 'thread': 0.10; 'python': 0.10; 'itself.': 0.11; '(other': 0.16; 'bind': 0.16; 'fond': 0.16; 'from:addr:martin': 0.16; 'luck,': 0.16; 'received:hsd1.or.comcast.net': 0.16; 'received:io': 0.16; 'received:or.comcast.net': 0.16; 'received:psf.io': 0.16; 'tcp': 0.16; 'app': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'issue.': 0.20; '(the': 0.22; 'martin': 0.22; 'cc:no real name:2**0': 0.22; 'code.': 0.23; 'header:In-Reply-To:1': 0.24; 'received:24': 0.28; 'fine': 0.28; "i'm": 0.30; 'server.': 0.30; 'code': 0.30; "can't": 0.32; 'class': 0.33; 'problem': 0.33; 'received:comcast.net': 0.33; 'server': 0.34; 'problem.': 0.35; 'reply.': 0.35; 'but': 0.36; 'should': 0.36; 'subject:: ': 0.37; 'client': 0.37; 'charset:us-ascii': 0.37; 'data': 0.39; 'waiting': 0.60; 'your': 0.60; 'received:network': 0.61; 'reply': 0.68; 'address,': 0.77; 'networking.': 0.84; 'glad': 0.87; 'leak': 0.91; 'thoroughly': 0.91
X-X-Sender mabrown@macron.wonderfrog.net
In-Reply-To <86a8ad2a-3185-4ff3-abe0-7345411fa0c2@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103516

Show key headers only | View raw


Hello again Ray,

>> >I'm new to python networking. I am waiting TCP server/client app by 
>> >using python built-in SocketServer. My problem is if client get 
>> >killed, then the tcp port will never get released, in CLOSE_WAIT
>> 
>> I did not thoroughly review your code (other than to see that you 
>> are not using SO_REUSEADDR).  This is the most likely problem.
>>
>> Suggestion:
>> 
>>   man 7 socket
>> 
>> Look for SO_REUSEADDR.  Then, apply what you have learned to your 
>> code.
>
>it's not I can't bind the address, my problem is: server is long 
>run. if client die without "disconnect" then server will leak one 
>socket.

Sorry for my trigger-happy, and incorrect reply.

After so many years, I should know better than to reply without 
completely processing questions.  Apologies.

>by using the built-in thread socket server. the extra tcp port are 
>opened by built-in class itself. if the handler() is finish 
>correctly (the line with break) then this socket will get cleaned 
>up. but if client dies, then I am never get out from that True 
>loop. so the socket will keep in close_wait
>
>I fond the issue. it's my own stupid issue.
>i did "continue" if no data received.
>just break from it then it will be fine

Well, I'm glad you found the issue.

Best of luck,

-Martin

-- 
Martin A. Brown
http://linux-ip.net/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

tcp networking question (CLOSE_WAIT) Ray <rui.vapps@gmail.com> - 2016-02-25 09:55 -0800
  Re: tcp networking question (CLOSE_WAIT) "Martin A. Brown" <martin@linux-ip.net> - 2016-02-25 10:17 -0800
    Re: tcp networking question (CLOSE_WAIT) Ray <rui.vapps@gmail.com> - 2016-02-25 10:25 -0800
      Re: tcp networking question (CLOSE_WAIT) "Martin A. Brown" <martin@linux-ip.net> - 2016-02-25 10:56 -0800
        Re: tcp networking question (CLOSE_WAIT) Ray <rui.vapps@gmail.com> - 2016-02-25 10:59 -0800
  Re: tcp networking question (CLOSE_WAIT) Ray <rui.vapps@gmail.com> - 2016-02-25 10:44 -0800

csiph-web