gen_server, gen_tcp question

Eric Merritt cyberlync@REDACTED
Wed Jul 17 20:31:52 CEST 2002


Here is the text from the relevent faq entry -->

Q.11 : One process in my application is typically
hanging in a call to gen_tcp:accept/1 waiting for a
connection request. How do I perform code change for
that process?

A: Let the implementation be such that another process
holds the listen socket and is linked to the process
hanging in gen_tcp:accept/1. Specify an update code
upgrade instruction with a very short timeout, which
will cause the process to be killed almost immediately
by the release handler, before the new version of the
call-back module for the process is loaded. Then let
the other process restart the process calling
gen_tcp:accept/1. 


 (I am still not thinking in erlang yet so forgive me
if I miss something obvious).

In the server portion after creating the listen socket
you would spawn a process whose only job would be to
accept any incoming connections? This is fairly strait
forward. I assume that you would not want this process
to spawn the worker thread to handle the connection,
considering it should be as simple as possible? What
should it do with an excepted socket then? Message it
back to the server and let the server handle it?  I
hope I am not displaying to much ignorance here. 

Thanks,
Eric


--- Kent Boortz <kent@REDACTED> wrote:
> 
> Eric Merritt <cyberlync@REDACTED> writes:
> >  Thanks allot this actually clears things up quite
> a
> > bit. I do have one question though, the rshell app
> you
> > mention does not seem to be in my erlang distro
> > (R8-1). Do you have any idea where I could get it
> > from? or do I need to recompile erlang with some
> > options set?
> 
> The application is under construction but can be
> found in the P9
> snapshots
> 
>   http://www.erlang.org/download/snapshots/
> 
> But I now have been informed that there are better
> ways to handle this
> but unfortunately not in detail. There may be some
> comments about this
> in the "OTP Application Upgrade FAQ" found at
> 
>   http://www.erlang.org/doc/misc/
> 
> kent


__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com



More information about the erlang-questions mailing list