TCPEvents : A better Network Event Receiver/Sender plugin

Questions and comments specific to a particular plugin should go here.
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

TCPEvents : A better Network Event Receiver/Sender plugin

Post by miljbee » Fri Dec 10, 2010 1:08 pm

Latest version can be downloaded here.
... and you can get a demo tree at the end of this post.

Edit 12 June 2014:
- Bug Fix : Fixed wrong behavior when suffix is only one char
- Bug Fix : Removed default prefix in the send event action

Edit 03 Feb 2013:
- Added the mandatory guid for the plugin (sorry !)
- Updated a few comments on the demo tree
- Serious work started on the corresponding C# client/server

Edit 02 Feb 2013:
Updated the demo tree to show the compatibility with the good old Network event Receiver/Sender Plugins

Edit 01 Feb 2013:
Updated and tested with the latest 2013 EG release ( and yes pako, it runs with the -translate switch ...).
It's in my "prod" tree and runs smoothly without any bugs since several months.
I have added a demo tree so you can quickly check and understand what it can do.

Edit 06 Jan 2010 :
Better Exception Handling

Edit 17 Dec 2010 :
BugFix : added a try/except arround the eval of the received payload in the server

Edit 16 Dec 2010 :
Improvement : added datetime module to the plugin to enable the exchange of datetime objects

Edit 13 Dec 2010 :
BugFix : RequestData/unable to read the response from the server if it sends close behind the response


Hello,

I find that the actual network event receiver/sender plugins are quiet limited.

So I wrote a new one.
The key features are :
  • This is a single plugin to send AND receive
    • You specify the destination host in the action (not in the plugin)
    It is fully compatible with the originals network event sender/receiver plugins:
    • You can send an event from this plugin and receive it with the network event receiver
      You can send an event with the network event sender and receive it with this new plugin
    You can choose the event prefix when sending
    You can send/receive payload of any type (at least simple ones : strings, numbers, lists, dicts, tuples, datetime ...)
    You can Send data without generating an event at the server side
    You can Send a python expression and the server will evaluate it and return the result without generating any event
Status of the plugin :
  • Please, consider it as beta, since I still don't use it in my "prod" tree.
    I wrote that plugin to be able to have a "rich" dialog between two of my computers, but also to exchange data with external programs written in C#. So you can expect me to re-write it in C# in "some" time. Once the C# part will be completed, I will integrate this into my "prod" tree.
Known Bug :
  • I have written the plugin based on the network event sender/receiver code. Unfortunately, there is a bug in the original plugins. And I haven't manage to solve it in my plugin.
    The bug occurs when the plugin is loaded and you restart eventghost.
    when you restart eventghost, there might be a 30s delay before the server might be able to receive data.
    I haven't been able to determine if it's a problem with closing properly the socket when exiting eventghost, or if it's when creating it when eg starts (Perhaps something with restartasynchcore).
    Anyway, if you haven't noticed this bug with the original network event receiver plugin, you shouldn't notice it with this one.
    If you have any idea about how to solve it, let me know.
Things you might want to know/understand
  • when sending an event, you can use {} in most params to have eg replace the content by the corresponding vars in eg.globals :
    • as an exemple, if you have 'test' in eg.globals.myVar, you can write {eg.globals.myVar} in the event suffix field. It will send 'test' as the event suffix to the server. It works with these fields :
      Hostname
      password
      event Prefix
      event Suffix
    when sending the payload with an event, you should write a python expression in the payload field. If you want to send just a plain text string, you should write it between quotes (or double quotes) :

    Code: Select all

    'my text'
    This enables you to send much more complex data. exemple :

    Code: Select all

    [1,"two",{3:"three"},eg.globals.myVar]
    The content of the payload field is always evaluated before being sent, so any variable will be replaced by its value

    when sending data, you should also write a python expression which will be evaluated before being sent (same thing as the event payload).
    when sending data, the server won't produce any event. It will only store it with the provided name.
    To get back the data at the server side, use the action "Retrieve Received Data". It will store the data in eg.result.
    • or just use eg.plugins.TCPEvents.GetData(u'data1') in your python scripts
    When Requesting data to a remote host, you write a plain python expression. exemple : eg.globals.myVar. The string you write here is sent to the server which will evaluate it and will return to the client the result of the evaluated expression. You get that result by reading eg.result.
I Hope you will like it. Let me know what you think of it.

regards,
Attachments
TCPEventsDemo.xml
(6.7 KiB) Downloaded 612 times
Last edited by miljbee on Thu Jun 12, 2014 1:38 pm, edited 6 times in total.
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by Pako » Sat Feb 02, 2013 8:57 am

miljbee wrote:Updated and tested with the latest 2013 EG release ( and yes pako, it runs with the -translate switch)
:D

Thank you - it looks like EventGhost will turn a little better.
I'll also definitely try it.

Pako

miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by miljbee » Thu Jun 12, 2014 1:45 pm

I Uploaded a new version to fix an issue when receiving an event with a suffix that is only one char length.

if you send prefix.s, you would get an event : defautPrefix.prefix.s

It's now fixed. And I added a few more checks for tricky eventstrings (those who starts or ends with a dot)

There was also a problem in the send event action who wouldn't allow you to store a SendEvent action with an empty prefix.

The C# DLL is still not ready for prime time. It needs more testing and some documentation. Perhap's it will be ready in a year or two !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

Rvergo
Posts: 2
Joined: Sat Jun 14, 2014 1:22 am

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by Rvergo » Sat Jun 14, 2014 1:28 am

Hi.

Im new to Eventghost.

is it posibel to remove all the safty there is in this plugin??

the reason is that im trying to get eventghost to vork with my RTI remote interface, and it can not send the hash + password.
or yes it can, if i was abele to make a driver for it, but im not.

all will be on local network so i dont have the problem with someone seeingen what there is beening sendt..

i have tryed to remove it my selv but when i try to add my modifyed plugin eventghost freeses...

Sem;colon
Experienced User
Posts: 609
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by Sem;colon » Sat Nov 29, 2014 8:57 pm

Hello,

I have a problem with the plugin I hope you can help me with:
I try to get a python list from one host to another with the "Request Data from a remote host" action
But I always get the ERROR "Can not eval the response from the server".
you can try this code as an example:

Code: Select all

print eg.plugins.TCPEvents.RequestData(u'127.0.0.1', 1024, u'', u'eg.pluginList')
Thank you in advance!

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by pearbear » Wed Jun 03, 2015 7:44 pm

I noticed that the same cookie is used for every event instead of a new one being generated each time and have fixed this security vulnerability:
https://raw.githubusercontent.com/per12 ... _init__.py

Thanks so much for this great plugin!
Per

Update:
2015-08-26
- Unauthenticated mode - leave password field blank to disable authentication
- Added timeout value settings to the plugin configuration

skribb
Experienced User
Posts: 224
Joined: Thu Feb 12, 2015 7:22 pm
Location: Win7 64bit

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by skribb » Sat Oct 17, 2015 5:43 pm

I can't get it to be received by TerRemote. Network Event Sender works ("Map" function). I tried send event and send data but none of them are received by TerRemote. What could be wrong? Thanks :D
Automation is life.

Win7 64bit
EG: v0.5.0-rc4

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by pearbear » Sun Oct 18, 2015 7:52 pm

skribb wrote:I can't get it to be received by TerRemote.
@skribb did you manage to get it working? Are you able to send from TerRemote to TCPEvents? I don't have a phone smart enough to run TerRemote but I am familiar with the innards of TCPEvents and would be willing to look into this.

skribb
Experienced User
Posts: 224
Joined: Thu Feb 12, 2015 7:22 pm
Location: Win7 64bit

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by skribb » Mon Oct 19, 2015 9:08 am

Well honestly it has a low priority with me since Network Sender works, and I don't send using TerRemote, I use UDP Sender for sending from my android to EG. I'll post again if I need help setting up TCPEvents, thanks :D
Automation is life.

Win7 64bit
EG: v0.5.0-rc4

zinodemidoff
Posts: 3
Joined: Wed Jul 06, 2016 7:07 pm

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by zinodemidoff » Sat Jul 16, 2016 8:17 pm

hi, what is format of tcp command? can i use hercules client for sending commands?

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by pearbear » Sun Jul 17, 2016 1:47 am

zinodemidoff wrote:hi, what is format of tcp command?
  • sender: Connect to receiver. Send quintessence\n\r.
  • receiver: Send cookie.
  • sender: The password is appended to the cookie and the MD5 digest is calculated and sent back to the receiver.
  • receiver: If the received MD5 digest is correct then it sends accept.
  • sender: Send payload {payload string}\n{event}\nclose\n to the receiver.
  • receiver: Close the connection to the sender.
zinodemidoff wrote:can i use hercules client for sending commands?
I'm not familiar with that program. I'd need more details. The MD5 part may be an issue if you don't want to manually calculate it, if so my fork has the ability to disable authentication by leaving the password field blank. Of course this means there will be no security but it it's only running on a local network that may not be an issue.

justahotbag2
Experienced User
Posts: 68
Joined: Fri Jan 27, 2017 8:16 pm
Location: New York, NY

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by justahotbag2 » Tue Apr 25, 2017 12:26 am

Hi there everyone,
This plugin is logging "TCP.quintessence" for everything. I'm using no password. Does anyone know what I'm doing wrong? Thanks in advance.

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by pearbear » Tue Apr 25, 2017 2:47 am

I'm guessing you're using my modified version of the plugin:
https://github.com/per1234/TCPEvents/
By leaving the password field blank you have turned off authentication (password protected events) but that only works if all devices communicating via the TCPEvents system have authentication turned off. quintessence is the "magic word" used to start the authentication process so that shows that the sender of the event is running in authenticated mode. What is the configuration of the sender?

justahotbag2
Experienced User
Posts: 68
Joined: Fri Jan 27, 2017 8:16 pm
Location: New York, NY

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by justahotbag2 » Wed Apr 26, 2017 9:55 pm

Yes I'm using that version. I'm using Tim Hoeck's Android App and the password is blank on all devices that send. I assume that turns off authentication. I literally just tried to dropped it in as a replacement, I have changed nothing from the default plugin & config.

pearbear
Experienced User
Posts: 150
Joined: Mon Apr 02, 2012 10:28 pm
Contact:

Re: TCPEvents : A better Network Event Receiver/Sender plugi

Post by pearbear » Sat Apr 29, 2017 10:40 am

OK, the problem is that you're using the Android App. Unauthenticated operation is only supported when you are sending/receiving events from TCPEvents to TCPEvents. The unauthenticated feature is something I added specially to my version of the plugin. No other EventGhost plugin or app supports unauthenticated communication. If you use a password it should work. I just tested it with that app. Just make sure you set the same password in the TCPEvents plugin configuration, the "Send an event" action configuration, and the EventGhost App configuration.

Post Reply