Subject: [clisp-list] lisp:socket-stream-peer

From: [email-masked] (Don Cohen)
Date: Tue, 22 May 2001 22:34:39 -0700 (PDT)

I may have asked this before.
It seems that lisp:socket-stream-peer does some sort of operation
(DNS lookup) that can take a very long time to complete.  I guess
that's cause it has an IP address and is trying to generate a name.
Is there some way to just get the IP address of the peer?
That's all I really want and I want it to take a small bounded 
amount of time.

---

From: Sam Steingold <[email-masked]>
Date: 23 May 2001 13:52:38 -0400

> * In message <[email-masked]>
> * On the subject of "[clisp-list] lisp:socket-stream-peer"
> * Sent on Tue, 22 May 2001 22:34:39 -0700 (PDT)
> * Honorable [email-masked] (Don Cohen) writes:
>

ext:socket-stream-peer is not a structure accessor.

you should not call it more than once for a given socket - the return
value does not change.

you should always expect network delays in network code.

If you use its value for pretty-printing, maybe the printed
representation of the socket object is what you are really after?

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
The early bird may get the worm, but the second mouse gets the cheese.

---

From: [email-masked] (Don Cohen)
Date: Wed, 23 May 2001 11:04:32 -0700 (PDT)

> ext:socket-stream-peer is not a structure accessor.
Right.  I want the structure accessor.  Is there one?
If not, could it be added?

 > you should not call it more than once for a given socket - the return
Even calling it once per stream is too often.

 > you should always expect network delays in network code.
But I don't want to call network code.  I just want the IP address of
the peer.

 > representation of the socket object is what you are really after?
I don't want it for pretty printing, I want to know the IP address of
the peer.  And the socket object does not print with the address of
the peer, only the address of the local machine.

So please tell me how I can get the IP address of the peer.
Right now I have to use socket-stream-peer to get a string and
then parse that to reconstruct the address.

---

From: Sam Steingold <[email-masked]>
Date: 23 May 2001 14:17:38 -0400

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] lisp:socket-stream-peer"
> * Sent on Wed, 23 May 2001 11:04:32 -0700 (PDT)
> I want to know the IP address of the peer.  
> 

what do you need this for?

We consider the IP address to be a low level detail which should not
be exposed.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
Those who can't write, write manuals.

---

From: [email-masked] (Don Cohen)
Date: Wed, 23 May 2001 11:47:47 -0700 (PDT)

> We consider the IP address to be a low level detail which should not

Well, I admit one thing I use it for is to print it in a log.
But I don't need the host name for that, just the address or,
if you like, the address string.
The other thing I use it for is to compare it to other addresses.
Again, if I just want to see whether two are the same I guess the
address string would do.  In fact I do more than that.  I do things
like testing whether two have the same first byte.  This is done
for access control reasons.  For instance, I want to not accept
connections (well, ok I accept, then test, then maybe close them)
from certain places or subnets, I don't want to have more than
a certain number of connections at a time open from certain places
or subnets, etc.

Is that a good enough explanation?

I know that when you want to write general purpose servers there 
are lots of other things that are not visible in clisp that you
really want to control.  Perhaps a lower level interface would be
the right way to go here.  For instance, if I could get from a
socket stream some c object that I could then pass to various
functions to control low level things that would help.  I'd also
like to be able to handle more than tcp packets one of these days.
But if you just give me the peer IP address accessor I promise not
to ask for any of that stuff for at least another week.  Deal?

---

From: Sam Steingold <[email-masked]>
Date: 24 May 2001 14:50:39 -0400

> * In message <[email-masked]>
> * Sent on Wed, 23 May 2001 11:47:47 -0700 (PDT)

get the latest CVS - ext:socket-stream-peer now takes a second optional
argument "fast-p" which turns off DNS lookup.

> For instance, if I could get from a socket stream some c object that I
> could then pass to various functions to control low level things that
> would help.

that's what FFI is for.

--
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
NY survival guide: when crossing a street, mind cars, not streetlights.

---

From: [email-masked] (Don Cohen)
Date: Thu, 24 May 2001 12:15:23 -0700 (PDT)

> argument "fast-p" which turns off DNS lookup.
Thanks, I look forward to it.
If fast-p is true it returns what, "1.2.3.4" ?

 > > could then pass to various functions to control low level things that
Yes I understand.  And I suppose that FFI already can give me the
object I need from the stream, but I don't know how to do it.
Am I supposed to?  Am I supposed to be able to find out by reading
the source or is this documented or is there documentation to tell
me how to find out or what?
No rush on this question, of course.  As I recall, I'm not supposed
to need any of that stuff for at least a week.

---

From: Sam Steingold <[email-masked]>
Date: 24 May 2001 16:05:16 -0400

> * In message <[email-masked]>
> * Sent on Thu, 24 May 2001 12:15:23 -0700 (PDT)

yes.  if you build --with-export-syscalls, you can use
`resolve-host-ipaddr' later.

> me how to find out or what?

can't help you here.

if you need the low-level stuff, you write it in C, add interface to
CLISP &c.

alternatively, you can try to convince me that we should export it in
CLISP :-)

If you are on Linux, you can build --with-module=bindings/linuxlibc6 and
you would probably have what you want.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
Apathy Club meeting this Friday.  If you want to come, you're not invited.

---

From: Dennis <[email-masked]>
Date: Tue, 29 May 2001 14:04:11 -0700 (MST)

Hi,

I've read Jeff Dalton's "A Brief Guide to CLOS". Is there a more detailed
discussion of CLOS on the net someone can point me to?

-- 
---
Dennis Sacks
[email-masked]