I'm trying to write a program in which I have to create custom events. I have seen some examples like Mr.Happy Object. My problem is that I'm not allowed to fire events myself and they have to be fired when a particular event has happened. Like a program that would print 80 if only data has come from the 80 port.
I really don't know how it could be possible. What is the thing that I have to use?