Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Network Receiver - Question on what is necessary & setup?

If you have a question or need help, this is the place to be.
Post Reply
jwka
Posts: 24
Joined: Sun Nov 28, 2010 8:45 pm

Network Receiver - Question on what is necessary & setup?

Post by jwka »

Hi,

I am having an app, that can send Sockets via TCPIP, which - from the app's debugger are truly sent to eg. - st least to the machine EG runs on.

I used port 10401 that shall be unused by any other app running on the pc, the firewall fo the test is switched off to be sure no problems on that end.

The only thing: EG does not produce an event in the log (all are logged) which I would suppose.

Question:

What about the password and the Prefix fields?

I assume password is not required, so empty.

But what about the "Prefix"? What's that?

Thanks for any help!
jwka
stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by stottle »

Take a look at the networkSender/Receiver code. There are some extra parameters required to get the receiver to accept a connection.

Brett
jwka
Posts: 24
Joined: Sun Nov 28, 2010 8:45 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by jwka »

Brett,

thanks for that hint.

Unfortunately, I am not familiar with Python yet - and too much other things at the moment on my list.

So, could you enlight me a bit with additional informatiion?

What exactly needs a sender to send to bring a text through and ahave the event fired in EG?

Thanks so much!
jwka
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orl├®ans, France

Re: Network Receiver - Question on what is necessary & setup?

Post by miljbee »

Hello,

the network event receiver isn't able to receive any type of data.

It can only generate an event in eg if it receives data fron the network event sender.

If you can control what your app sends then here is what you need :
send "quintessence\n"
receive a cookie (an arbitry string)
send MD5Hash(cookie+":"+password) + "\n"
receive "accept\n" (if md5 match)
send "payload "+yourPayload+"\n" if you want to join a payload to your event
send "payload "+yourPayload+"\n" if you want to join more data to your event
send "payload "+yourPayload+"\n" if you want to join even more data to your event
and so ....
send eventSuffix+"\n"
send "close\n" you are done
close the socket.

This will generate an event in eventghost.
The prefix will be the one you entered in the plugin conf (Default TCP)
The suffix will be the one you sent over TCP (eventSuffix)
The payload will be a list containing [u'IpAddress of the client',yourPayload,yourPayload,yourPayload,...]

Regards,
Last edited by miljbee on Tue Dec 14, 2010 7:16 am, edited 3 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.
stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by stottle »

miljbee wrote:It can only generate an event in eg if it receives data fron the network event sender.
I'm guessing this is a typo and you meant that NetworkReceiver will only generate events if the input socket is in NetworkSender format? Because I think you described the format so any program that sends the above information over a socket on the right port can communicate with a NetworkReceiver instance.

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

Re: Network Receiver - Question on what is necessary & setup?

Post by miljbee »

you are right. Sorry for my bad english
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by stottle »

No worries :D . You are posting good info, just wanted to make sure a typo didn't take away from its usefulness.

Brett
jwka
Posts: 24
Joined: Sun Nov 28, 2010 8:45 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by jwka »

miljbee, strottle,

Thanks so much for that Infos which enlight truly why I was not successful! I have not read this from the Python code.

I guess that protocol is a pain for a true internal process, because this is too much of a burden ... it will be nice for a secured app and so on, but for a simple comm it's just overloaded. In my case, additionally, i have the trouble that my code needs to be quite fast due to limited timeslice my PHP code gets on my domotic server (for stability reasones etc.).

I have read some other threads here and I have seen that there had been another people dealing with the Receiver stuff.

Two Questions if you allow:
1.) Do you know of an implementation that is simpler - just accepts any text to generate an event so the code behind that event needs to deal with "allowence" etc.?

2.) I have some code here but "only" in .py where in the sub foders of the installed product, there is allways also an pyc. Is that pyc necessary and if so, how to get such pyc?

Again, thank you so much for your help, your informatin is invaluable.

If we can drive this site further, I would be happy to help writing some Wiki articles to help other users also.

Thanks & regards
jwka
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orl├®ans, France

Re: Network Receiver - Question on what is necessary & setup?

Post by miljbee »

I guess that protocol is a pain for a true internal process, because this is too much of a burden ... it will be nice for a secured app and so on, but for a simple comm it's just overloaded.
It's not that difficult. Plus, You can start from the code of the Network Event Sender plugin. (you will find it in the eg plugin dir). I don't know php, but I feel it might not be that difficult if you have the equivalent code in python.
In my case, additionally, i have the trouble that my code needs to be quite fast due to limited timeslice my PHP code gets on my domotic server (for stability reasones etc.).
I don't think we will notice any delay with this plugin.
1.) Do you know of an implementation that is simpler - just accepts any text to generate an event so the code behind that event needs to deal with "allowence" etc.?
  • You can try the udp broadcaster. It's much simpler, but in my experience it will eat 100% of one of your cpu time (perhaps the problem is my computer), try it and see !

    You can also use the webserver. Add the webserver plugin to your eg tree and just send hime basic GET requests :

    Code: Select all

    http://your_Eventghost/?YourEvent
    The problem is that the webServer of eg is known to be really slow. But once again, try it and see (also, you will have to compute the authorization header if called from code) !

    If your php server allows it, and if it runs on the same computer that eventGhost, you can also just call eventghost.exe -e yourEvent. But if you generate a high rate of events (let's say 50 in one second), this method can lead to several eventghost process being started and frozen.

    You can also try xPL. There is a plugin for it, and I am pretty sure that some php code already exists for xPL. If you don't know xPL, it's a protocol based on udp and designed for Home Automation.

    Finally you can invoke eventGhost Members. I don't know if this could work with php, but here is how it's done with C# :
    http://www.eventghost.org/forum/viewtop ... =10&t=1322 (I haven't tested)
2.) I have some code here but "only" in .py where in the sub foders of the installed product, there is allways also an pyc. Is that pyc necessary and if so, how to get such pyc?
For eventghost, .py is the source code. .pyc is the compiled code (this one is really needed, it's the one which is executed). When you start eventghost, it will automatically compile your .py (thus producing .pyc) if they have changed since last run.

Let me know what you will finally use, I am always interrested about dialog between eg and the rest of the world !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orl├®ans, France

Re: Network Receiver - Question on what is necessary & setup?

Post by miljbee »

I forgot the -n param of the eventghost commandline.

It enables you to send an event using the network event receiver plugin.

Code: Select all

eventghost.exe -n <host>:<port> <password> <eventname> [<payload> ...]
doc here :
http://www.eventghost.org/docs/commandline.html
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
jwka
Posts: 24
Joined: Sun Nov 28, 2010 8:45 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by jwka »

miljbee,

thanks for that exhaustive explanation. I need to deal with it, I fear. Hope to find the time soon to investigate Python a bit more in depth, maybe I will write a "simple receiver" from the one that is implemented at the moment. Since I do not produce the pyc files, that's one hurdle less.

As said, I have so much things on my list at the moment (including reprogramming some Atmel Processor firmware) that it could easily take a few weeks until I will be able to deal with it.

Will give feedback (and for sure some Q's additionally) when doing it.

Thanks again for your help - I really appreciate!

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

Re: Network Receiver - Question on what is necessary & setup?

Post by miljbee »

Merry Christmas jwka !

here is your gift !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
jwka
Posts: 24
Joined: Sun Nov 28, 2010 8:45 pm

Re: Network Receiver - Question on what is necessary & setup?

Post by jwka »

Great!

I just need to bring on PC back to life (hop that will not take the whole day ...) then I will immediatly try out the thing you posted.

Hope it will work. Will feedback on that other thread!

Thanks again! Hope I can sometime give back some value to you and others also.
jwka
Post Reply