Broadcasting is one of two modes of operation on SunNET. This mode is usually not accessible to non-wizards. I consider it the lower level of operation since all other communication depends upon it, but it has the advantage of being able.
There is one verb for transmitting a broadcast.
$sunnet_utils:broadcast(STR destination, STR protocol, ANY
message, [OBJ ack object, STR ack verb, [OBJ fail object, STR fail
verb]])destination site for the packet. The special site GENERAL
may be used to send a packet to all sites. The second is the
protocol for the message. The third is the packet
message which can be any legal MOO value. Be warned that some
values may not translate if your MOO has special server hacks to implement
non-standard values. Following those three required arguments, you can
specify an ACK handler (or success handler) or a FAIL handler. The ACK
handler is called when a packet is transmitted successfully while the FAIL
handler is called when a packet does not appear to have gotten through. If
you specify a fail handler you should specify and ACK handler. If you enter
a #-1 for the object, either handler will be ignored. These handlers are
also referred to as call-backs. This verb returns the packet id for the
message you sent.
For each broadcast, you can specify two verbs (See above). One verb is the ACK call-Back and the second is the FAIL call-back.
obj:callback(id, pathto, pathfrom, senttime)id is the packet id originally returned by the
$sunnet_utils:broadcast verb. settime is the
timestamp of the packet. (You can use this by comparing it with time() to
see how long it took for the remote site to respond.. It could possibly be
used as a measurement of NetLag.) pathto and
pathfrom will usually be mirrors of one another provided they
are the fastest path from the local site to the remote site. The first is
the path followed to the MOO while the second is the path from the MOO. If
either is blank then the packet was sent as a GENERAL destination packet.
This can be used with the association method listed below to clear the
association.
obj:callback(id, pathto, pathfrom, senttime)id is the packet id originally returned by the
$sunnet_utils:broadcast verb. settime is the
timestamp of the packet. pathto and pathfrom are
not applicable as the packet was not sent anywhere so they will always be
empty lists. A sample use of the fail handler would be to resend important
packets. Since the Id is returned on calling
$sunnet_utils:broadcast, it would be fairly easy to associate
the packet message with that id. Then when the fail handler is called, the
program could wait a moment then resend the data.