Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Has anyone done server-client using lisp-java?

9 views
Skip to first unread message

Vivek Mittal

unread,
Jan 13, 1999, 3:00:00 AM1/13/99
to
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


Mark Watson

unread,
Jan 13, 1999, 3:00:00 AM1/13/99
to
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.)

Jason Trenouth

unread,
Jan 14, 1999, 3:00:00 AM1/14/99
to
On 13 Jan 1999 03:39:04 GMT, vi...@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:
>
> (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?

You could use a higher level interface between the two languages. E.g. if you
used a Java ORB in the client and a Common Lisp ORB in the server then both
application components would be able to deal with objects and function calls
instead of low level socket details.

__Jason

Marc Cavazza

unread,
Jan 19, 1999, 3:00:00 AM1/19/99
to

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: M.Ca...@bradford.ac.uk
BD7 1DP -- United Kingdom
____________________________________________________________________

Alex Athanasopoulos

unread,
Jan 26, 1999, 3:00:00 AM1/26/99
to Jason Trenouth
Jason Trenouth wrote:

>
> On 13 Jan 1999 03:39:04 GMT, vi...@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.

0 new messages