UDP sockets - again

John Rule johnrule at rcsprogramming.com
Mon Feb 28 10:29:40 EST 2005

	I think the inconsistency lies in the lack of documentation
regarding 'when' to use the 'with message' and 'how' RunRev is calling these
(or possibly this is a bug). For example:

## Some of these examples assume an open datagram socket...

Write "STATUS" to socket udpSocket with message "getData"


Read from socket udpSocket with message "getData"
Write "STATUS" to socket udpSocket


Open datagram socket to udpSocket with message "getData"
Write "STATUS" to socket udpSocket


Accept connections on port udpPort with message "getData"
Write "STATUS" to socket udpSocket

	The handler "getData" is not called everytime, and the parameters
only have data 'sometimes', but my 'sniffer' shows that my device is ALWAYS
responding. What is the appropriate sequence, and WHEN does RunRev call
these 'with message' handlers?! I am getting unreliable results using

	Logically, you would think that once I instruct the handler to
'read' from a UDP socket whenever it gets data (i.e. I have set the callback
handler), it should ALWAYS call this handler when data is received on that
open udp socket. Or, when I write data to an open udp socket with a handler
message, if the destination socket responds with data, the handler should be
called immediately. It does not ALWAYS work this way, but it is close, so I
believe there is a problem.

I do not have issues with regular sockets, just datagram sockets...

Here are my questions that I cannot find an answer to in the documentation:

- Once the "getData" handler is set, how often is it called?

- If I write to an open UPD socket with a handler message, is the handler
called 'anytime' data is received, or only for that call (i.e. am I setting
some internal function pointer)?

- Is the data stored somewhere when it is received for retrieval using 'read
from socket'?

- Is the data accumulated? How large is the buffer? Can I set this?

- How many parameters are there for the handlers?

- Once I set the callback handler, is it 'always' set? Is it reset when the
socket is closed?

- If I set a callback handler for ANY call (i.e. open 'with', write 'with',
read 'with', accept 'with') is this handler going to be called for ANY data

	I feel like I am shooting in the dark, and I am disappointed that
this information is not somewhere in the docs. Withholding this info (for
'Enterprise' or 'RevList' users) does not make me want to upgrade...it makes
me want to look somewhere else for solutions.

Thanks for any info,
John Rule

More information about the Use-livecode mailing list