Jess's simple I/O router system is a copy of the one in CLIPS. It's
sufficient for some situations, but not for others. This is really not
at all a serious problem because for those other situations there are
at least two choices: write some code in Java and call it from Jess,
or write the code in Jess by invoking Java APIs directly. In Jess 7,
you might do an asynchronous read like this:

(defglobal ?*message* = nil)
(deffunction read-async (?socket)
  (bind ?r (implement Runnable using (lambda (?name)
    (bind ?*message* (readline ?socket)))))
  ((new Thread ?r) start))

Of course, now the main program has to spend its time polling
?*message* to see when a message shows up. Alternatively, you could
supply a callback to this routine -- but that does complicate matters.

As you can see, writing a good agent communication platform isn't
rocket science, but it's not a trivial undertaking. Why reinvent the
wheel? There are a number of existing Java agent frameworks that
support Jess-based agents -- just Google for them (one of them -- Jade
-- is mentioned in another thread that just passed by on this mailing

I think Marek Pawlowski wrote:
[Charset iso-8859-2 unsupported, filtering to ASCII...]
>    I would like to ask about a quite serious problem in jess. I'm working on 
> a student project "Agents in Power Systems", developed in Jess. Agents are 
> communicating with each other over TCP/IP sockets. To accomplish this, a 
> broadcasting TCP server has
> been written.
> While sending messages via jess is not hard to implementing, message 
> retrieval is close-to-impossible to write. The problem is, the usage of read 
> and readline functions causes the whole jess instance to hang until a 
> message on the server appears. While jess doesn't have a function which 
> checks if any data is waiting on a connected socket, the soulution would be 
> to use a non-blocking reading function, which also is not available in jess.
> Maybe somebody could suggest a solution to this problem.
> Any help is appreciated.
> (I do not have Java knowledge sufficient to write it as a java program) 

Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550

To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]

Reply via email to