MOO-cows Mailing List Archive


Re: listen()

>How does one set up a do_login_command for it to actually use the port set
>up with listen()?

listen() has the syntax listen(obj, desc[, print-messages]).  desc is the
port, print-messages you'll usually set to 1 and obj is the object on which
the do_login_command should go to be used by connections to that port.

The usual example:
#0:do_login_command is called for all commands coming in from normal users
connected by telnet.  If you want port 9999 to be used in just the same way
(another telnet port into the MOO), you use the command listen(#0, 9999, 1).

Another example:
You want port 9000 to work as a port for a WWW system (say), and have an
object called $web_system with a verb :do_login_command that you want all
connections to be processed through.  You set that up with the command
listen($web_system, 9000, 0) (don't want messages 'cos it confuses the WWW

So in fact it's the listen() that sets up which do_login_command to use,
not the other way around.  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.

Hope this helps,


Jeni Tennison
Department of Psychology, University of Nottingham
University Park, Nottingham NG7 2RD, UK
tel: +44 (0) 115 951 5151 x8352
fax: +44 (0) 115 951 5361

Follow-Ups: References:

Home | Subject Index | Thread Index