sockets and Windows behavior

Dar Scott dsc at swcp.com
Sat Feb 12 23:51:24 EST 2005


On Feb 12, 2005, at 8:36 AM, John Rule wrote:

>   Maybe the problem is in doing broadcast messages in general on 
> Windows
> (this same code works fine on OSX...Linux is another issue 
> altogether). It
> doesn't work consistently (I do not always get the callback to my 
> 'with'
> message, the average is 6 out of 10).
>
>   Using a 'sniffer', I am ALWAYS getting my response from the devices. 
> It
> seems like it is just that the messages are not always finding their 
> way
> back to my callback handler (in Windows XP).
>
> Is this a problem, or is there a better way?

If the devices are responding to the ip address and port that sent the 
query, then this might be your problem:  The doc is lacking on using 
UDP.  The callback for 'open datagram socket' is not for open.  (It 
would be sent immediately, if it was.)  It is for read.  Scott Raney 
says to use that instead of read.

If the devices are not responding to the port that sent the broadcast, 
but to some specific port then I guess the above does not apply; you 
would be using accept.  If the messages are very large or a very large 
number comes in at once, then Windows will lose some.  There are some 
system parameters that can be tweeked, but I forgot what they are.

Dar

-- 
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming Services and Software
**********************************************



More information about the use-livecode mailing list