Subject: Re: Open_network_connection()

From: Andrew Wilson <[email-masked]>
Date: Tue, 16 Mar 1993 04:52:15 -0800

WEB sez:

> I have a question: Why does o_n_c() work the way it does in terms of being
> a 'one-way' connection? I mean, from everything that I've seen, you have to
> send all your commands down the network and then close the connection before
> you can read what the server has buffered up. If this is not the case, please
> correct me. Anyway, an interractive o_n_c() would be nice particularly when
> debugging for example a MOO to smtp interface.

Mmm, ok, by way of a partial correction, onc() doesn't force you to close the
connection before rendering up any output from whatever it was you connected to.
However, your server doesn't SEND any information until the task that's
producing the output either completes or suspends, or tries to read.  When
you're trying to debug code that uses onc() it's often helpful to flush the
information out of the buffers explicitly.  MOO doesn't have a flush()
built-in but you can use suspend(0) intead.

For example:

	Conn = open_network_connection(<wherever>);
	Conn:notify("Foo...");
	"Force 'Foo...' to be sent...";
	suspend(0);
	... rest of verb ...

Perhaps this goes some way to explaining your observations.  If you want to be
certain about it then try contacting Grump@LambdaMOO/Larry@JaysHouseMOO or
Blackbriar@LambdaMOO/OpalMOO.  Their $gopher and $services systems both use
onc() in a variety of ways, and I think they've both got MOO to smtp
functionality worked out.

Andy.