send UDP message

1,123 views
Skip to first unread message

Sarmad Al-Mashta

unread,
Jun 19, 2016, 11:30:26 PM6/19/16
to Alt-F
I would like to send a UDP message (string) when system temperature reaches Warn Temp. in the SysCtrl configuration ... this will alert my home automation to start extra fan in the room

I am a window user, so I would appreciate a bit detailed guide if possible ....

any help is highly appreciated


P.S. great job guys I've been running Alt-F for a year on DNS-323 ...
 

João Cardoso

unread,
Jun 20, 2016, 3:00:11 PM6/20/16
to Alt-F


On Monday, 20 June 2016 04:30:26 UTC+1, Sarmad Al-Mashta wrote:
I would like to send a UDP message (string) when system temperature reaches Warn Temp. in the SysCtrl configuration ... this will alert my home automation to start extra fan in the room

I am a window user, so I would appreciate a bit detailed guide if possible ....

You probably need 'netcat', search for its man page:

 NAME
     nc — arbitrary TCP and UDP connections and listens

SYNOPSIS
     nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
        [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol] [-x
        proxy_address[:port]] [hostname] [port[s]]

DESCRIPTION
     The nc (or netcat) utility is used for just about anything under the sun involv-
     ing TCP or UDP.  It can open TCP connections, send UDP packets, listen on arbi-
     trary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6.
     Unlike telnet(1), nc scripts nicely, and separates error messages onto standard
     error instead of sending them to standard output, as telnet(1) does with some.
... 
 DATA TRANSFER
     The example in the previous section can be expanded to build a basic data trans-
     fer model.  Any information input into one end of the connection will be output
     to the other end, and input and output can be easily captured in order to emulate
     file transfer.

     Start by using nc to listen on a specific port, with output captured into a file:

           $ nc -l 1234 > filename.out

     Using a second machine, connect to the listening nc process, feeding it the file
     which is to be transferred:

           $ nc host.example.com 1234 < filename.in

     After the file has been transferred, the connection will close automatically.


You should then write a shell script that when invoked executes netcat with the appropriate options, make it executable (chmod), test it on its own, and finally add the full path script as the command to execute under Services->System->sysctrl, Configure

The busybox netcat implementation is called 'nc', so there is no need to install the netcat package itself; however, busybox nc is much simpler and I don't know if it does what you want to do:

[root@DNS-325]# nc --help
BusyBox v1.20.2 (2016-03-14 06:47:18 WET) multi-call binary.

Usage: nc [-iN] [-wN] [-l] [-p PORT] [-f FILE|IPADDR PORT] [-e PROG]

Open a pipe to IP:PORT or FILE

        -e PROG Run PROG after connect
        -l      Listen mode, for inbound connects
                (use -l twice with -e for persistent server)
        -p PORT Local port
        -w SEC  Timeout for connect
        -i SEC  Delay interval for lines sent
        -f FILE Use file (ala /dev/ttyS0) instead of network

Sarmad Al-Mashta

unread,
Jun 27, 2016, 11:25:19 AM6/27/16
to al...@googlegroups.com
Thank You Joao  for the super fast reply ... I will look into and try to figure it out ... I have a good stating point now, tx
Reply all
Reply to author
Forward
0 new messages