Announcement

Collapse
No announcement yet.

[DLL, EXE and script] UDP Broadcast

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [DLL, EXE and script] UDP Broadcast

    (Sorry for previous post. The zip was too big to attach. You can download it from here:

    Download UDP Broadcast client and server


    This is a two part program which can be used to send and receive UDP broadcast messages across a network.

    I've written it primarily with Homeseer scripting in mind, although there is no reason why it can't be integrated into other applications. I in fact use it successfully within my home grown caller ID software (I don't use Homeseer Phone).

    There are two parts to this program.

    1) The Server
    2) The Client(s)

    The Server application is a small .dll file called "HACommunication_events.dll".

    Copy this file to your preferred location on the server (I would suggest c:\windows\system32 or equivalent).

    At the command prompt, navigate to this directory, and type:

    Regsvr32 HACommunication_events.dll

    This will register the component with your system which will allow you to send UDP broadcast messages.


    In order to receive these messages, you need to run software on each client within the network on which you want messages to be received.

    Copy the "HAClient.exe" program to your preferred location on each client machine (I would suggest within the "program files" folder). To run, simply create a shortcut, or double click on the .exe file.

    To broadcast a message, add the following code to a script file:

    Set oBroadcast = CreateObject("HACommunication_events.HACommunication")
    oBroadcast.text = "{message=this is a test message}"
    oBroadcast.broadcast
    set oBroadcast = nothing


    This will popup a message on all machines within the network running the HAClient software.


    The "text" property of the Server can be used to pass a number of options. All options are separated by a | character, and the full text must be enclosed in { and }

    Message=<this is the text to send to the client>
    Priority=low|medium|high
    Icon=House|Phone|Gate

    The priority option is used to tell the client what priority this message will be sent at. Different priority settings can be configured on the client to appear in different styles, sizes or colours. Clients can also be configured to ignore "low" priority messages. For example, I have my movement sensors configured to set a message at low priority as I don't always want notification that they've detected movement, however I have my garden gate sensor set at high priority as I want to make sure I notice when the gate opens!.

    The "icon" option can optionally be used to display an icon on the popup message. Currently there are only three icons available: a telephone (icon=phone) a house (icon=house) and a gate (icon=gate).

    There are also other options which can be set at the client, although and it's important to realise that these options, if set, will override any settings selected on the client. These include:

    gradientcolour1=FFFFFF
    gradientcolour2=000000
    height=<popup height in pixels>
    width=<popup width in pixels>
    right=<how far in from the right of the screen the popup appears>
    bottom=<how far in from the bottom of the screen the popup appears>
    timeout=<the length of time (in seconds) the popup stays viewable>
    transparency=<the transparency of the popup (windows 2000 and later only)>


    UDP broadcasting will only work over a single network (although it does appear to work across a VPN). I may start working on a more customiable "internet aware" version, which will allow messages to be sent across the Internet if time allows and interest is high enough.

    Please remember this is the first public release of software I initial wrote purely for my own use. Please, please drop me an email if you find this useful or if you have any comments or suggestions.

    Email: dev@zz9.com

    Web:
    http://www.the-firs.org/ (Fast HA site)
    http://www.the-firs.net/ (Slow, "live" HA site)


    Usual disclaimers apply!

    Regards,
    Adam.
Working...
X