Inter-process communication, how? Part 2

Guilherme Polo ggpolo at gmail.com
Mon Dec 24 07:21:24 EST 2007


2007/12/24, Bjoern Schliessmann <usenet-mail-0306.20.chr0n0ss at spamgourmet.com>:
> Hendrik van Rooyen wrote:
> > <ecir.hana at gmail.com> wrote:
>
> >> What I don't like about FIFO, is that on Unix they are persistent
> >> files. So whatever happens to Manager they would stay there...
> >> I was just wondering if there's another way of doing the above
> >> and if not, I would probably go with FIFO. Thanks!
> >
> > The persistence bit is true, and can lead to puzzling behaviour
> > when you are still debugging, as the recipient can get a mix of
> > old and new data after a crash.
> >
> > It is probably best to delete them and create them for every run,
> > either in a BASH script, or in the Python programme that first
> > opens the pipe.
>
> You could also drain the pipe in a script using
> "cat <pipe-goes-here>".
>
> > As for the alternative, on Linux, sockets seem to hang around for
> > a while after a run, until the OS deletes them, so that repetitive
> > execution can give you a socket in use error.

To solve that "problem" with socket in use error, you should set the
SO_REUSEADDR socket option in the server before calling bind.

>
> In my experience this only happens if you kill the program. If it
> terminates normally it should close its socket so it is "freed"
> immediately.
>

Supossing you run the client and server on the same machine, then when
the client finishes the connection normally, client final state is
TIME_WAIT (and this is not a bad thing actually, like some people
seems to think).

Why TIME_WAIT state exists: to allow old duplicates segments to expire
in the network, and, to implement TCP's full-duplex connection
termination reliability.

> Grüße,
>
>
> Björn
>
> --
> BOFH excuse #422:
>
> Someone else stole your IP address, call the Internet detectives!
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list