From: Vivek Mittal
Subject: Has anyone done server-client using lisp-java?
Date: 
Message-ID: <77h4go$dk8$1@towncrier.cc.monash.edu.au>
I've got a bunch of lisp code that I would like to call from java.  I've
set up a server in lisp using the wire package on a free port on the
server.  However, I have not been able to write a java client to send
and receive the commands and results.

My client correctly opens a socket to the port and transmit a string
containing the lisp command I want to run.  However, my lisp server does
not receive the command.  Instead i get the error:

(COMMON-LISP::DO-ERROR "~S cannot be coerced to a character." (40))

My knowledge of lisp is limited, but it looks like it received the
string, but was expecting a character.  I used wire:read-newline-string
server-wire to obtain data from the port.

Has anyone done something similar like this before or has any idea what
i am doing wrong?

Thanks
Vivek

From: Mark Watson
Subject: Re: Has anyone done server-client using lisp-java?
Date: 
Message-ID: <369CC405.6D1BF89F@markwatson.com>
Hello Vivek,

re:
> My client correctly opens a socket to the port and transmit a string
> containing the lisp command I want to run.  However, my lisp server does
> not receive the command.  Instead i get the error:
> 
> (COMMON-LISP::DO-ERROR "~S cannot be coerced to a character." (40))
> 
> My knowledge of lisp is limited, but it looks like it received the
> string, but was expecting a character.  I used wire:read-newline-string
> server-wire to obtain data from the port.

Make sure that the Java code is not sending 16 bit unicode characters.
Also, I find it useful to (sometimes) write server apps so that they
use HTTP, so you can test the server part using any-old-web-browser.

-Mark

-- Mark Watson, consultant and author of 11 books on AI, Java, C++.
-- http://www.markwatson.com for Open Source (Java, NLPserver, etc.)
From: Marc Cavazza
Subject: Re: Has anyone done server-client using lisp-java?
Date: 
Message-ID: <36A49CB4.7049DC2@bradford.ac.uk>
Vivek Mittal wrote:

> I've got a bunch of lisp code that I would like to call from java.  I've
> set up a server in lisp using the wire package on a free port on the
> server.  However, I have not been able to write a java client to send
> and receive the commands and results.
>
> My client correctly opens a socket to the port and transmit a string
> containing the lisp command I want to run.  However, my lisp server does
> not receive the command.  Instead i get the error:
>
> (COMMON-LISP::DO-ERROR "~S cannot be coerced to a character." (40))
>
> My knowledge of lisp is limited, but it looks like it received the
> string, but was expecting a character.  I used wire:read-newline-string
> server-wire to obtain data from the port.
>
> Has anyone done something similar like this before or has any idea what
> i am doing wrong?

Vivek,

The closest thing I did is C-Allegro socket-based communication (modifying
example code from Franz's website -- credits :-). And I too initially
encountered
some problems with the handling of strings/characters on both sides.
However, I
avoid these by using READ-LINE from the Lisp stream produced when accepting
connection to the socket.

Now, I'm not familiar with the wire package. Assuming it generates a Lisp
stream
from the socket connection, is this a text stream or a binary stream?

Hope this helps,

Marc
--
____________________________________________________________________
Prof. Marc Cavazza              http://www.eimc.brad.ac.uk/~mcavazza

EIMC Department                 Phone: +44 (0)1274 236 135
University of Bradford          Fax:   +44 (0)1274 383 727
Bradford, West Yorkshire        E-mail: ·········@bradford.ac.uk
BD7 1DP -- United Kingdom
____________________________________________________________________
From: Alex Athanasopoulos
Subject: Re: Has anyone done server-client using lisp-java?
Date: 
Message-ID: <36AE6083.CBB88F43@Franz.com>
Jason Trenouth wrote:
> 
> On 13 Jan 1999 03:39:04 GMT, ·····@yoyo.cc.monash.edu.au (Vivek Mittal) wrote:
> 
> > I've got a bunch of lisp code that I would like to call from java.  I've
> > set up a server in lisp using the wire package on a free port on the
> > server.  However, I have not been able to write a java client to send
> > and receive the commands and results.
> >
> > My client correctly opens a socket to the port and transmit a string
> > containing the lisp command I want to run.  However, my lisp server does
> > not receive the command.  Instead i get the error:
> >
...

I do that.  I use plain sockets and send/receive strings terminated with
newlines.  I use read-line on the lisp side to read from the socket.