From: baselnovo
Subject: Passing data between ABCL and ACL processes
Date: 
Message-ID: <33ccbcf5-ba8e-46b5-82c2-689cbf9fc7af@c19g2000prh.googlegroups.com>
The reason for wanting to do this is that ABCL (Armed Bear Common
Lisp) makes it incredibly easy to create interfaces with opensource
java programs, though ACL seems to do better at most other things that
don't involve java.  I thought of opening sockets for sharing data
between ABCL and ACL, except that, afaik, ABCL doesn't support
creating sockets.  Since ABCL is basically a java program itself that
runs from a jar file, there should be some way to create a jlinker or
jil interface to ABCL, but I don't know how to go about it, since I
almost never use either jlinker or jil.

If anyone has any first-hand experience at all with bringing data from
an ABCL<->java interface back into an ACL environment, I'd be really
interested in hearing about it.  The OS is Solaris 8.

Thanks!

From: Dmitry Kalyanov
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <6385d597-67d0-452e-95ff-30feec385130@t11g2000vbc.googlegroups.com>
On 20 ÉÀÎ, 05:16, baselnovo <·········@gmail.com> wrote:
> afaik, ABCL doesn't support creating sockets.

usocket[1] (portable common lisp library for sockets) supports ABCL.


http://common-lisp.net/project/usocket/
From: baselnovo
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <451e3ea8-00b8-4027-b34e-c3072224b334@z8g2000prd.googlegroups.com>
On Jun 19, 10:48 pm, Dmitry Kalyanov <···············@gmail.com>
wrote:
> On 20 ÉÀÎ, 05:16, baselnovo <·········@gmail.com> wrote:
>
> > afaik, ABCL doesn't support creating sockets.
>
> usocket[1] (portable common lisp library for sockets) supports ABCL.
>
> http://common-lisp.net/project/usocket/

Thanks, this seems as though it should do just what I need.  Once I
found and loaded the split-sequence code usocket loaded just fine.
Hopefully I can find a way to configure it to listen for Lisp
expressions and send back the results of evaluating them.

Thanks again!
From: baselnovo
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <a896ce5c-662d-450a-9433-c531b56a8b2a@x25g2000prf.googlegroups.com>
On Jun 19, 10:48 pm, Dmitry Kalyanov <···············@gmail.com>
wrote:
> On 20 ÉÀÎ, 05:16,baselnovo<·········@gmail.com> wrote:
>
> > afaik, ABCL doesn't support creating sockets.
>
> usocket[1] (portable common lisp library for sockets) supports ABCL.
>
> http://common-lisp.net/project/usocket/

Hi,

Just to follow up on this, I did download usocket and it installed
without difficulty in both ABCL and ACL.  However, I never found a way
to use it for what I was originally trying to do, namely passing data
between ABCL and ACL processes.  Btw, I didn't realize it before, but
ABCL does have some sockets capabilities defined in its EXT package
(see sockets.lisp in the ABCL distribution).  However I didn't have
any luck using this either.

On the ACL side, I've tried using functions from the acl-socket and
usocket packages to send data to ABCL using its EXT and and also the
usocket library.  I thought that perhaps using the usocket library on
both the ACL and ABCL sides would work since objects of the same ttpe
are being created/returned on both sides, but even this didn't work
for me.

Somehow it seems easier to think that I'm missing something rather
that that there's no way to pass data between ACL and ABCL via
sockets. Before giving up on this, I thought I'd check whether /
anyone/ has done something similar to what I'm trying to do here.

Any ideas welcome.

Thanks,

Ben
From: Alessio Stalla
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <ab1bf336-1aea-41c4-903f-88d7a41bcbbd@h8g2000yqm.googlegroups.com>
On Jul 7, 9:41 pm, baselnovo <·········@gmail.com> wrote:
> On Jun 19, 10:48 pm, Dmitry Kalyanov <···············@gmail.com>
> wrote:
>
> > On 20 ÉÀÎ, 05:16,baselnovo<·········@gmail.com> wrote:
>
> > > afaik, ABCL doesn't support creating sockets.
>
> > usocket[1] (portable common lisp library for sockets) supports ABCL.
>
> >http://common-lisp.net/project/usocket/
>
> Hi,
>
> Just to follow up on this, I did download usocket and it installed
> without difficulty in both ABCL and ACL.  However, I never found a way
> to use it for what I was originally trying to do, namely passing data
> between ABCL and ACL processes.  Btw, I didn't realize it before, but
> ABCL does have some sockets capabilities defined in its EXT package
> (see sockets.lisp in the ABCL distribution).  However I didn't have
> any luck using this either.
>
> On the ACL side, I've tried using functions from the acl-socket and
> usocket packages to send data to ABCL using its EXT and and also the
> usocket library.  I thought that perhaps using the usocket library on
> both the ACL and ABCL sides would work since objects of the same ttpe
> are being created/returned on both sides, but even this didn't work
> for me.
>
> Somehow it seems easier to think that I'm missing something rather
> that that there's no way to pass data between ACL and ABCL via
> sockets. Before giving up on this, I thought I'd check whether /
> anyone/ has done something similar to what I'm trying to do here.

It's not clear to me what kind of data are you trying to send/receive,
nor which problems you have encountered. Can you be more specific?

You talking about "objects of the same type" makes me suspicious:
sockets don't know about objects, they only know about bytes. So
clearly if you want to send an object through a socket, you need to
serialize it to bytes in an implementation-independent format so that
you can reconstruct it on the other side of the communication.

hth,
Alessio
From: fortunatus
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <599c44af-3d19-41c3-9e1c-634b30ab1f80@2g2000prl.googlegroups.com>
On Jul 7, 4:38 pm, Alessio Stalla <·············@gmail.com> wrote:

> clearly if you want to send an object through a socket, you need to
> serialize it to bytes in an implementation-independent format so that
> you can reconstruct it on the other side of the communication.

PRINT and READ can help there...
From: baselnovo
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <afe1c1a5-a456-4fe7-8021-7f56d96b3cab@m3g2000pri.googlegroups.com>
On Jul 7, 1:38 pm, Alessio Stalla <·············@gmail.com> wrote:
> On Jul 7, 9:41 pm, baselnovo <·········@gmail.com> wrote:
>
>
>
> > On Jun 19, 10:48 pm, Dmitry Kalyanov <···············@gmail.com>
> > wrote:
>
> > > On 20 ÉÀÎ, 05:16,baselnovo<·········@gmail.com> wrote:
>
> > > > afaik, ABCL doesn't support creating sockets.
>
> > > usocket[1] (portable common lisp library for sockets) supports ABCL.
>
> > >http://common-lisp.net/project/usocket/
>
> > Hi,
>
> > Just to follow up on this, I did download usocket and it installed
> > without difficulty in both ABCL and ACL.  However, I never found a way
> > to use it for what I was originally trying to do, namely passing data
> > between ABCL and ACL processes.  Btw, I didn't realize it before, but
> > ABCL does have some sockets capabilities defined in its EXT package
> > (see sockets.lisp in the ABCL distribution).  However I didn't have
> > any luck using this either.
>
> > On the ACL side, I've tried using functions from the acl-socket and
> > usocket packages to send data to ABCL using its EXT and and also the
> > usocket library.  I thought that perhaps using the usocket library on
> > both the ACL and ABCL sides would work since objects of the same ttpe
> > are being created/returned on both sides, but even this didn't work
> > for me.
>
> > Somehow it seems easier to think that I'm missing something rather
> > that that there's no way to pass data between ACL and ABCL via
> > sockets. Before giving up on this, I thought I'd check whether /
> > anyone/ has done something similar to what I'm trying to do here.
>
> It's not clear to me what kind of data are you trying to send/receive,
> nor which problems you have encountered. Can you be more specific?


Sure.  Let's say ABCL is interfacing with a java POS tagger and I want
to send a sexpr from ACL in the form of a string like,
"(tag-phrase \"connective tissue disease proven by kidney biopsy\")",
have ABCL evaluate the expression and send a tagged phrase back to
ACL.

> You talking about "objects of the same type" makes me suspicious:

I'm not sure why.  I'm thinking of a case like,

(setq sock9003 (acl-socket:make-socket :type :datagram))
==>
#<MULTIVALENT datagram socket at */63353 @ #x5da9572>

(type-of sock9003)
 ^^^^
==>
ACL-SOCKET:SOCKET-DATAGRAM-INTERNET-ACTIVE

> sockets don't know about objects, they only know about bytes.

Okay, I see what you mean, maybe "object" was a poor choice of words.
Anyway, does the example above help clarify what I'm trying to send
and receive?  If not, please let me know.  And btw, the main obstacle
so far has been that there's no evidence that anything that's being
sent from one process is being received by the other process.

>So clearly if you want to send an object through a socket, you need to
> serialize it to bytes in an implementation-independent format so that
> you can reconstruct it on the other side of the communication.
>
> hth,
> Alessio

The thing is, I'm not completely sure that either usocket or acl-
sockets were designed to make it possible to send and receive data /
specifically between ACL and ABCL processes/. If someone with first-
hand experience with doing this could weigh in, that would be great!

Thanks,

Ben
From: Alessio Stalla
Subject: Re: Passing data between ABCL and ACL processes
Date: 
Message-ID: <9fc1b867-349d-40a9-a18c-e659cc34dea0@i6g2000yqj.googlegroups.com>
On Jul 8, 2:45 am, baselnovo <·········@gmail.com> wrote:
> Sure.  Let's say ABCL is interfacing with a java POS tagger and I want
> to send a sexpr from ACL in the form of a string like,
> "(tag-phrase \"connective tissue disease proven by kidney biopsy\")",
> have ABCL evaluate the expression and send a tagged phrase back to
> ACL.

Ok, I assume a tagged phrase is a string or a sexp or something which
can printed/read, right?

> > You talking about "objects of the same type" makes me suspicious:
>
> I'm not sure why.  I'm thinking of a case like,
>
> (setq sock9003 (acl-socket:make-socket :type :datagram))
> ==>
> #<MULTIVALENT datagram socket at */63353 @ #x5da9572>
>
> (type-of sock9003)
>  ^^^^
> ==>
> ACL-SOCKET:SOCKET-DATAGRAM-INTERNET-ACTIVE

Ok, sorry, I misunderstood you, I thought you were talking about
objects to be sent/received. Objects representing sockets are
implementation-dependent and have nothing to do with the data
exchanged on the wire, so you can safely use different socket
libraries to communicate between different processes.

> > sockets don't know about objects, they only know about bytes.
>
> Okay, I see what you mean, maybe "object" was a poor choice of words.
> Anyway, does the example above help clarify what I'm trying to send
> and receive?  If not, please let me know.  And btw, the main obstacle
> so far has been that there's no evidence that anything that's being
> sent from one process is being received by the other process.

There can be a number of reasons for this. Be sure to read carefully
usocket's and acl-sockets' documentation, and in general to clearly
understand socket concepts (ports, connections, server-sockets and
whatnot).
Besides, for the kind of thing you're doing, I'd not use datagram
sockets, which use the UDP protocol and are therefore unreliable - a
message might not arrive, or arrive twice, or multiple messages might
not arrive in the same order they were sent, in general. Of course if
your processes are on the same machine none of this should happen, but
regular TCP sockets, besides being connection-based and reliable, have
the added benefit that you can use them as streams (I don't know
usocket, but all the socket libraries I've seen for various languages
allow this). But this is all dependent on your goal, of course.

> The thing is, I'm not completely sure that either usocket or acl-
> sockets were designed to make it possible to send and receive data /
> specifically between ACL and ABCL processes/. If someone with first-
> hand experience with doing this could weigh in, that would be great!

Sockets have been designed to send and receive data between arbitrary
processes running on arbitrary machines with arbitrary OSes ;) so,
they must work in your particular case, too. Probably you're doing
something wrong. However, I don't have first-hand experience on this -
maybe usocket on abcl is terribly broken? Try sending/receiving data
in the same process first (between ACL and itself, and between ABCL
and itself), and see what happens. And/or, post some actual code
showing what you're doing.

Bye,
Alessio

> Thanks,
>
> Ben