Article View: comp.lang.lisp.x
Article #22Re: unix sockets
From: Peter Ashwood-Smith 1600361
Date: Mon, 13 Apr 1992 14:37
Date: Mon, 13 Apr 1992 14:37
31 lines
1829 bytes
1829 bytes
> (Hume Smith) > has anyone tried adding socket functions to xlisp? any ideas how to > make it sort-of pretty, unlike the C underneath? I added socket based communications to PC-LISP for our CAD tools on SUN/RS/APOLLO and HP workstations. Similar things could easily be done with XLisp. We created a (socketopen <addr> <port> [<timeout>] function. If provided, the <timeout> indicated an active connection, if absent the connection was passive. The function simply returned a normal file descriptor which could be (read) etc. using the normal I/O functions. This meant that S-expressions could be sent through the sockets and read on the other side. We used the TCP_STREAM protocol and modified the (read)/(print) functions to keep track of the last I/O direction used and to rewind(fd) if the direction changed. With this done, the normal I/O functions were used for socket based communications and the socketopen function was used to open the connection. We even set up asynchronous socketopen/read/eval/print loops at the top of some of our CAD tools so that the tool could asynchronously receive a LISP S-expression, evaluate it, and print the result back to the sender. Beats the heck out of formatting packets and you get not only data exchange but control exchange too! Peter Ashwood-Smith.
Technical Details
Message-ID:
<1992Apr13.143707.22399@bmerh2.bnr.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!stl!bnrgate!bmerh2!bcrka398!peteraReferences:
<850347s.702942952@aucs>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!stl!bnrgate!bmerh2!bcrka398!petera From: petera@bcrka398.bnr.ca (Peter Ashwood-Smith 1600361) Newsgroups: comp.lang.lisp.x Subject: Re: unix sockets Message-ID: <1992Apr13.143707.22399@bmerh2.bnr.ca> Date: 13 Apr 92 14:37:07 GMT References: <850347s.702942952@aucs> Sender: news@bmerh2.bnr.ca (Usenet News Admin) Reply-To: petera@bcrka398.bnr.ca (Peter Ashwood-Smith 1600361) Organization: Bell-Northern Research, Ottawa, Canada Lines: 31