Generic Event Triggering

I’m trying to trigger a generic event I created (named UnlockDevice1Handler). As far as I understood (by reading the docs) if I just write “UnlockDevice1Handler\r\n” to port 1235 (it is enabled and the terminating characters are 13, 10) it should trigger, right? Here’s the sample code:

try (var socket = new Socket(“192.168.1.240”, 1235)) {

socket.setSoTimeout(5000);

try (var os = socket.getOutputStream()) {

os.write(“UnlockDevice1Handler\r\n”.getBytes());

os.flush();

}

} catch (Exception e) {

e.printStackTrace();

}

Can anyone point what I am doing wrong?

Hi. Could you please document (screenshot), how you have configured the Generic Event in the Management client – both the source and event part.

Sure! Here.

It looks ok. How are you checking that the event is triggered. Did you create rule or do you look for event in some window?

The second question - “192.168.1.240”, 1235 - should be your Event Server address / port. Check also the firewall is open on this port on event server.

You can also look up the event server URL from the registered services.

https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_util_1_1_service_util.html&tree=tree_search.html?search=registered+services

I programmed a rule to create a log whenever I trigger that event, as in the post below. Is this the right way? How can I know if it worked correctly?

Where are you running the application to send the generic event text over the network? By default, only local connections will be trusted by the Event Server. If you will be sending the string over the network from a different computer, you’ll want to add the source IP to the list of allowed external addresses in Management Client under Tools > Options > Generic Events.

You mentioned port 1235, and that is the default port for the “International” Generic Event data source. This is disabled by default, and your screenshot shows your generic event is using the “Compatible” data source which uses port 1234 by default, and does not have the 13,10 separator bytes by default.

Double check that the generic event data source you ​want to use is enabled in Tools > Options, that you have added the external address of the application sending the message if applicable, and verify which port you’ll be using. Then make sure the generic event you created is set to the right data source (compatible, international, or some custom entry).

Alright! I set the datasource as International and it worked flawlessly. Thank you so much! :clinking_beer_mugs:

Happy to hear it! Cheers

Thank you, Joshua! I think you’re right. I neglected the “Datasource” option in the event. I’m testing it now and hopefully bringing back positive results. :grin: