UDP Broadcast (was Re: Program Linking)

Dar Scott dsc at swcp.com
Mon Mar 18 02:15:01 EST 2002


On Sunday, March 17, 2002, at 04:23 PM, Ian Summerfield wrote:

> Is this the proper approach?
>
> on mouseup
>   accept datagram connections on port 3052 with message "gotGram"
> end mouseup
>
> on gotGram fromwho,what
>   if what is not empty then
>     -- do whatever I want with the data
>   end if
>   read from socket 3052 with message "gotGram"
> end gotGram

I've been thinking about this notion of "proper."

Remember, I think that I think OS X has a bug and any workaround is 
"proper."

I think something like this would work on Windows 2000 and probably 
on Mac OS 9.2:

on mouseup
   accept datagram connections on port 3052 with message "gotGram"
end mouseup

on gotGram fromwhom,what
   -- do whatever I want with the data
end gotGram

That may be the intended scheme for receiving datagrams.  If so, 
anything we do on OS X should keep that in mind and may have to 
continue to work should a future version go to the same behavior as 
on other platforms.  Workarounds thus deviate from the "proper" way 
in a sense.

However, some might think that "accept datagram socket" should work 
more like "accept socket" (TCP) with new sockets created and then 
used for reads and writes.  Perhaps they think this is the "proper" 
way.  (Your method, Ian, looks like a cross between this and the 
one above.  Since it worked as well as it did, this may be part of 
the designer's thinking.)

I think a reasonable programming alternative--should Rev be 
expanded to do this--would be to "open datagram" with the local 
port specified in addition to the remote port and to read and write 
on that socket.  One might argue that this is the "proper" way.

I feel confident that the Runtime Revolution people will fix things 
and any evolution will be toward something clean, simple, powerful, 
uniform, complete and rich.  It may not be what I or any of us 
would think up or what we are used to from other environments, but 
it would be "proper."

Dar Scott






More information about the use-livecode mailing list