Re: How do I add an event handler that listens to a specific port?

> Hi,
> My goal is the following: I want to have amaya listen to two different
> ports and handle the corresponding inputs. Both ports will be reading
> strings. The first one will be reading strings of the type "load url X"
> which will need urlevent handlers. The second will be reading strings of
> the type "go forward", "go back", "go back 2 pages" which will need action
> handlers.
> 
> I was wondering how to put a listener to listen to these two ports and wait
> for strings to come in the event loop. I also don't know which event
> handlers to call so they take care of the incoming string commands. How do
> I find out where they are and how to use them?
> 
> What I would eventually like to have is a listener in the event loop which
> whenever gets an incoming string, identify it and call the corresponding
> handler and handle it right on the spot.
> I checked the code at eventloop.c and also at thotlib/dialogue/interface.c
> and it looks to me I need to modify parts of Thot library
> (TtaHandleOneEvent or ThotEvent) to add the extra functionality that I
> want. Is this the correct way to go? Is there a simpler way so I can only
> modify amaya code?

The Amaya main loop is managed by the function TtaMainLoop in 
Amaya/thotlib/dialogue/interface.c
You have to declare a socket and to register it. See also the code of 
RequestRegisterReadXtevent in Amaya/amaya/AHTBridge.c

> 
> Any help or relevant code samples would greatly be appreciated
> Nikos
> 

-- 
     Irene.

Received on Thursday, 24 August 2000 11:04:13 UTC