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


Groups > comp.lang.python > #103514

Re: tcp networking question (CLOSE_WAIT)

Newsgroups comp.lang.python
Date 2016-02-25 10:25 -0800
References <7ff15c67-102e-4b02-a2c8-87b24f1b8351@googlegroups.com> <mailman.133.1456424259.20994.python-list@python.org>
Message-ID <86a8ad2a-3185-4ff3-abe0-7345411fa0c2@googlegroups.com> (permalink)
Subject Re: tcp networking question (CLOSE_WAIT)
From Ray <rui.vapps@gmail.com>

Show all headers | View raw


On Thursday, February 25, 2016 at 1:18:05 PM UTC-5, Martin A. Brown wrote:
> >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.
> 
> -Martin
> 
> -- 
> Martin A. Brown
> http://linux-ip.net/

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. 

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 

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