Tcp/udp Sending and receiving

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Dvir Hamami
Posts: 1
Joined: 14 Aug 2017 05:03

Tcp/udp Sending and receiving

Post by Dvir Hamami » 24 Aug 2017 05:17

Please add these options

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Tcp/udp Sending and receiving

Post by bogdyro » 24 Aug 2017 08:48

Hi. There's a Tasker plug-in that sends\receives tcp packets. Works with automagic too.
Haven't figured out how to use it properly though. Maybe you can give it a try.
https://play.google.com/store/apps/deta ... sendexpect

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Tcp/udp Sending and receiving

Post by Desmanto » 24 Aug 2017 13:36

+1 for this feature. For example of TCP send/receive, as stated above, there is plugin Send/Expect
https://play.google.com/store/apps/deta ... sendexpect
This is a paid plugin.

While for UDP sender, there is plugin UDP sender
https://play.google.com/store/apps/deta ... .udpsender
It is free, but it doesn't support receiver, so maybe need to add the listener function to it.

This is different with HTTP request, which probably are the most common protocol we use.

The use case of this is quite niche, mostly in IoT or home automation. I have a wifi smart socket (Orvibo S20), but it doesn't support any automation app. So I craft a UDP packet as the command to turn it on/off. But UDP sender doesn't support receiver, so I don't get the feedback after sending the command. TCP is used if the IoT device use TCP.

The main point of this feature is we are able to craft raw TCP/UDP packet and receive the raw feedback/response. Of coz, it must support variable at the IP, port and packet sent/received. It will be nice to have some example use also, such as : DNS, DHCP, ARP, MQTT, SNMP, NTP, telnet and etc.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Tcp/udp Sending and receiving

Post by BoBo » 30 Aug 2017 22:40

+1
Was able to send a text using an Autohotkey script to my android device via UDP (kinda coincidence as I've done this for the first time ever, today!)
That way I could return status messages about running business processes to my mobile.
Would love if A4A could push a string via UDP (eg to trigger several other things like my live stream recording VLC scripts on my PC).

A nice sample of a minimalistic UDP app :arrow: UDP Tool

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Tcp/udp Sending and receiving

Post by Desmanto » 31 Aug 2017 17:18

BoBo wrote:+1
Was able to send a text using an Autohotkey script to my android device via UDP (kinda coincidence as I've done this for the first time ever, today!)
That way I could return status messages about running business processes to my mobile.
Would love if A4A could push a string via UDP (eg to trigger several other things like my live stream recording VLC scripts on my PC).

A nice sample of a minimalistic UDP app :arrow: UDP Tool
Can share the link to the example of your Autohotkey UDP server? Just to make sure we are on the same page.

If you want only to communicate to your PC, you can just use web server. It is easier. (I planned to type the tutorial, but I still have another tutorial for other user in our local forum.)
I have done it via EventGhost, no need UDP, just HTTP. But still can't find ways to have the eventghost to receive the uploaded file from automagic.
For clipboard sharing (between PC and Phone) and uploading file from PC to phone have been done. Only uploading file to PC still in progress.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Tcp/udp Sending and receiving

Post by BoBo » 18 Sep 2017 11:56

Desmanto wrote:
BoBo wrote:Can share the link to the example of your Autohotkey UDP server? Just to make sure we are on the same page.

If you want only to communicate to your PC, you can just use web server. It is easier. (I planned to type the tutorial, but I still have another tutorial for other user in our local forum.)
I have done it via EventGhost, no need UDP, just HTTP. But still can't find ways to have the eventghost to receive the uploaded file from automagic.
For clipboard sharing (between PC and Phone) and uploading file from PC to phone have been done. Only uploading file to PC still in progress.
[Android] MyControl - trigger your (compiled) scripts via your mobile phone
AHKSock Implementation (TCP for AHK): :mrgreen:

thewild
Posts: 12
Joined: 10 Mar 2017 10:13

Re: Tcp/udp Sending and receiving

Post by thewild » 02 Jan 2018 15:17

Hi all

I would also love to have this UDP sending+listener action.
This would be very useful for IoT scripts.
A very simple example : send a UDP multicast packet for service discovery (i.e. SSDP, mDNS/ZeroConf, ...).

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: Tcp/udp Sending and receiving

Post by TraianC » 21 Jan 2018 22:54

+1
I would love to have UDP send feature.

elektroinside
Posts: 69
Joined: 14 Feb 2019 15:04

Re: Tcp/udp Sending and receiving

Post by elektroinside » 17 Feb 2019 07:18

Hi guys,

My first post, so I first would like to express my gratitude for this project and app, it's simply phenomenal and made my life way easier.
I'm using it to automate my house, phone and generally my life.

I would love to see this feature. I'm using the send/expect tasker plugin to manipulate some Yeelight led strips, but because the plugin is using tasker variables to return the results.. well, i dont have any in Automagic.

Thanks again :)

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Tcp/udp Sending and receiving

Post by Desmanto » 17 Feb 2019 10:09

I have been testing this since yesterday using netcat binary. Manual is here : https://linux.die.net/man/1/nc
It is provided by busybox nc command, so non root user should be able to install busybox non root version to get the tool. I still struggle with the ssdp discovery service, because nc drop the packet when the response doesn't come from the same IP address. It was stated to use tcpdump to get the discovery info. But if you know the IP address already of the yeelight, you can use the similar as mine.

Code: Select all

toggle = '{"id":0,"method":"toggle","params":[]}\r\n';
cmd = "( echo -ne '{toggle}'; sleep 0.5 ) | nc -w1 192.168.1.100 55443";
Use {cmd} in execute root command. (or execute command for non root user).

This command will toggle the yeelight bulb 800 lumen, on or off. Replace the IP with the IP of the bulb. It will be of course much better to have this function built-in.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Locked