# listen()

Jeff Dubrule (igor@linguist.dartmouth.edu)
Thu, 27 Feb 1997 10:36:20 PST

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    At 4:51 AM -0800 2/27/97, Jeni Tennison wrote:
    >>How does one set up a do_login_command for it to actually use the port set
    >>up with listen()?
    > [SNIP!!]
    >  And in general, *all* the verbs that are defined
    >on #0 usually can be defined on the object given in the listen() command
    >and will work on that port.  So having $web_system:handle_uncaught_error
    >will do the same as #0:handle_uncaught_error does for the startup port, but
    >for connections through port 9000.

    No.  All uncaught errors and timeouts get shafted to #0, but you can
    compensate with a few lines of code:

    @program #0.handle_uncaught_error
    player = args[4][1][5];
    try
      port = tonum($string_utils:explode(connection_name(player))[2]);
      listener = $list_utils:assoc(port, listeners(), 2)[1];
    except (E_INVARG)
      listener = this;
    endtry
    if (listener != this)
      try
        return listener:handle_uncaught_error(@args);
      except (E_VERBNF)
      endtry
    else
      for x in (args[5])
        notify(player, x);
      endfor
    endif
    .

    -manta